Technologies for object-oriented memory management with extended segmentation

ABSTRACT

Technologies for memory management with memory protection extension include a computing device having a processor with one or more protection extensions. The processor may load a logical address including a segment base, effective limit, and effective address and generate a linear address as a function of the logical address with the effective limit as a mask. The processor may switch to a new task described by a task state segment extension. The task state extension may specify a low-latency segmentation mode. The processor may prohibit access to a descriptor in a local descriptor table with a descriptor privilege level lower than the current privilege level of the processor. The computing device may load a secure enclave using secure enclave support of the processor. The secure enclave may load an unsandbox and a sandboxed application in a user privilege level of the processor. Other embodiments are described and claimed.

CROSS-REFERENCE TO RELATED U.S. PATENT APPLICATION

This Application is a continuation of and claims the benefit of andpriority to U.S. application Ser. No. 17/346,757, entitled TECHNOLOGIESFOR OBJECT-ORIENTED MEMORY MANAGEMENT WITH EXTENDED SEGMENTATION, byMichael LeMay, et al., filed Jun. 14, 2021, now allowed, which is acontinuation of and claims the benefit of and priority to U.S.application Ser. No. 16/218,908, entitled TECHNOLOGIES FOROBJECT-ORIENTED MEMORY MANAGEMENT WITH EXTENDED SEGMENTATION, by MichaelLeMay, et al., filed Dec. 13, 2018, now issued as U.S. Pat. No.11,036,850, which is a continuation of and claims the benefit of andpriority to U.S. application Ser. No. 15/283,317, entitled TECHNOLOGIESFOR OBJECT-ORIENTED MEMORY MANAGEMENT WITH EXTENDED SEGMENTATION, byMichael LeMay, et al., filed Oct. 1, 2016, now issued as U.S. Pat. No.10,157,277, the entire contents of which are incorporated herein byreference.

BACKGROUND

Certain computer processors support partitioning logical memory spaceinto multiple partitions. For example, certain processors manufacturedby Intel Corporation support a segmented memory model when operating in32-bit mode. In those processors, a memory access instruction mayspecify a logical address (sometimes called a far pointer) that includesa segment selector and an effective address. The segment selector, whichmay be stored in a dedicated segment register (e.g., CS, SS, DS, ES,etc.) may be used to locate a segment descriptor. The segment descriptorincludes a segment base and an effective limit. The processor adds thesegment base to the effective address to generate a linear address. Theprocessor may generate a general protection fault or other exception ifthe effective address exceeds the effective limit. The processor thenuses a memory management unit and one or more page tables to translatethe linear address into a physical memory address.

Most modern operating systems use a flat memory model, effectivelydisabling the segmentation features of the processor. For example, theoperating system may treat the entire virtual memory space as a singlesegment. Additionally, support for memory segmentation is typicallylimited for processors operating in 64-bit mode. For example, in 64-bitmode the segment base for most segments is required to be zero, and theeffective limit is not checked.

Current processors may provide support for a trusted executionenvironment such as a secure enclave. Secure enclaves include ranges ofmemory (including code and/or data) protected by the processor fromunauthorized access including unauthorized reads and writes. Inparticular, certain processors may include Intel® Software GuardExtensions (SGX) to provide secure enclave support. SGX providesconfidentiality, integrity, and replay-protection to the secure enclavedata while the data is resident in the platform memory and thus providesprotection against both software and hardware attacks. The on-chipboundary forms a natural security boundary, where data and code may bestored in plaintext and assumed to be secure. Current processors may notsupport certain segmentation features from within an SGX secure enclave.For example, certain processors may require the segment base to be setto zero for most segments within a secure enclave and may disallowinstructions that manipulate segment registers (other than the FS and GSregisters).

BRIEF DESCRIPTION OF THE DRAWINGS

The concepts described herein are illustrated by way of example and notby way of limitation in the accompanying figures. For simplicity andclarity of illustration, elements illustrated in the figures are notnecessarily drawn to scale. Where considered appropriate, referencelabels have been repeated among the figures to indicate corresponding oranalogous elements.

FIG. 1 is a simplified block diagram of at least one embodiment of acomputing device for memory management with memory protectionextensions;

FIG. 2 is a simplified block diagram of at least one embodiment of anenvironment that may be established by the computing device of FIG. 1 ;

FIG. 3 is a simplified flow diagram of at least one embodiment of amethod for application sandboxing using protection extensions that maybe executed by the computing device of FIGS. 1-2 ;

FIG. 4 is a simplified block diagram of a software environment that maybe established during execution of the method of FIG. 3 ;

FIG. 5 is a simplified flow diagram of at least one embodiment of amethod for low-latency segmentation that may be executed by thecomputing device of FIGS. 1-2 ;

FIG. 6 is a schematic diagram illustrating logical address translationthat may be performed during execution of the method of FIG. 5 ;

FIG. 7 is a simplified flow diagram of at least one embodiment of amethod for task switching that may be executed by the computing deviceof FIGS. 1-2 ;

FIG. 8 is a schematic diagram of a task-state segment extension that maybe accessed during execution of the method of FIG. 7 ;

FIG. 9 is a simplified flow diagram of at least one embodiment of amethod for call gate execution with privilege checking that may beexecuted by the computing device of FIGS. 1-2 ;

FIG. 10 is a simplified flow diagram of at least one embodiment of amethod for transferring between protection domains that may be executedby the computing device of FIGS. 1-2 ;

FIG. 11 is a schematic diagram of a domain object selector that may beaccessed during execution of the method of FIG. 10 ;

FIG. 12 is a schematic diagram of various data segments that may beaccessed during execution of the method of FIG. 10 ;

FIG. 13 is a simplified flow diagram of at least one embodiment of amethod for executing a call with call stack segment checking that may beexecuted by the computing device of FIGS. 1-2 ;

FIG. 14 is a simplified flow diagram of at least one embodiment of amethod for executing a return with call stack segment checking that maybe executed by the computing device of FIGS. 1-2 ;

FIG. 15 is a simplified flow diagram of at least one embodiment of amethod for accessing an extended descriptor that may be executed by thecomputing device of FIGS. 1-2 ;

FIG. 16 is a schematic diagram illustrating extended descriptor tablesthat may be accessed during execution of the method of FIG. 15 ;

FIG. 17 is a simplified flow diagram of at least one embodiment of amethod for executing a sandboxed application that may be executed by thecomputing device of FIGS. 1-2 ;

FIG. 18 is a schematic diagram illustrating sandbox configurationregisters that may be established by the computing device of FIGS. 1-2 ;

FIG. 19 is a simplified flow diagram of at least one embodiment of amethod for enforcing segment-linked memory bounds that may be executedby the computing device of FIGS. 1-2 ;

FIG. 20 is a schematic diagram illustrating segment-linked rangeregisters and associated configuration registers that may be establishedby the computing device of FIGS. 1-2 ;

FIG. 21 is a simplified flow diagram of at least one embodiment of amethod for switching between threads that may be executed by thecomputing device of FIGS. 1-2 ;

FIG. 22 is a schematic diagram illustrating a memory layout that may beestablished by the computing device of FIGS. 1-2 ;

FIG. 23 is a simplified flow diagram of at least one embodiment of amethod for executing a near return instruction that may be executed bythe computing device of FIGS. 1-2 ;

FIG. 24 is a schematic diagram illustrating shadow stack configurationregisters that may be established by the computing device of FIGS. 1-2 ;and

FIG. 25 is a simplified flow diagram of at least one embodiment of amethod for handling a system call instruction that may be executed bythe computing device of FIGS. 1-2 .

DETAILED DESCRIPTION OF THE DRAWINGS

While the concepts of the present disclosure are susceptible to variousmodifications and alternative forms, specific embodiments thereof havebeen shown by way of example in the drawings and will be describedherein in detail. It should be understood, however, that there is nointent to limit the concepts of the present disclosure to the particularforms disclosed, but on the contrary, the intention is to cover allmodifications, equivalents, and alternatives consistent with the presentdisclosure and the appended claims.

References in the specification to “one embodiment,” “an embodiment,”“an illustrative embodiment,” etc., indicate that the embodimentdescribed may include a particular feature, structure, orcharacteristic, but every embodiment may or may not necessarily includethat particular feature, structure, or characteristic. Moreover, suchphrases are not necessarily referring to the same embodiment. Further,when a particular feature, structure, or characteristic is described inconnection with an embodiment, it is submitted that it is within theknowledge of one skilled in the art to effect such feature, structure,or characteristic in connection with other embodiments whether or notexplicitly described. Additionally, it should be appreciated that itemsincluded in a list in the form of “at least one of A, B, and C” can mean(A); (B); (C); (A and B); (A and C); (B and C); or (A, B, and C).Similarly, items listed in the form of “at least one of A, B, or C” canmean (A); (B); (C); (A and B); (A and C); (B and C); or (A, B, and C).

The disclosed embodiments may be implemented, in some cases, inhardware, firmware, software, or any combination thereof. The disclosedembodiments may also be implemented as instructions carried by or storedon one or more transitory or non-transitory machine-readable (e.g.,computer-readable) storage media, which may be read and executed by oneor more processors. A machine-readable storage medium may be embodied asany storage device, mechanism, or other physical structure for storingor transmitting information in a form readable by a machine (e.g., avolatile or non-volatile memory, a media disc, or other media device).

In the drawings, some structural or method features may be shown inspecific arrangements and/or orderings. However, it should beappreciated that such specific arrangements and/or orderings may not berequired. Rather, in some embodiments, such features may be arranged ina different manner and/or order than shown in the illustrative figures.Additionally, the inclusion of a structural or method feature in aparticular figure is not meant to imply that such feature is required inall embodiments and, in some embodiments, may not be included or may becombined with other features.

Referring now to FIG. 1 , in an illustrative embodiment, a computingdevice 100 for memory management with protection extensions includes aprocessor 120 that supports one or more protection extensions to specifyand enforce segment limit checks efficiently for 64-bit addresses. Insome embodiments, the processor 120 may support a low-latencysegmentation mode that efficiently enforces segment limits, even for64-bit addressing. In some embodiments, the processor 120 may supportextended processor-based task switching to activate the low-latencysegmentation mode. The extended task switching framework may includeaccess control checks to allow supervisor code (e.g., ringlevel 0) tosafely delegate sandbox management to user-level code (e.g., ringlevel3) and to safely virtualize system call instructions. In someembodiments, the processor 120 may support segmentation and sandboxingusing protection domains rather than the processor-based task switchingmechanism. The processor 120 may also support a control stack segment toregulate control flow and thereby potentially prevent stack-basedexploits. In some embodiments, the processor 120 may also supportextended descriptors and extended descriptor tables to manage memorysegments. Additionally or alternatively, as described further below inconnection with FIGS. 17-25 , the processor 120 may support memoryprotection using one or more segment-linked range registers (SLRRs) anda fast exception dispatch technique.

Those protection extensions may allow, for example, efficient memoryprotection and data isolation between applications or between differentparts of a single application, without relying on memory paging ortraditional virtualization. In particular, the protection extensions mayallow user-level code (e.g., ringlevel 3) to configure and manageisolation of other user-level code. The protection extensions maysupport transparent protection of sandboxed application code, meaningthat unmodified binary applications may be executed and protected.Accordingly, the computing device 100 may efficiently support memoryprotection and isolation for unmodified, containerized user-levelapplications. By using protection extensions of the processor 120, thecomputing device 100 may provide improved performance and reducedcomplexity as compared to software-only isolation approaches. Thecomputing device 100 also supports efficient segmentation addresscalculation and limit checking for 64-bit addresses. Additionally,because the sandboxed application(s) and the unsandbox management codeboth execute as unprivileged code, the computing device 100 may avoidmode-switching overhead associated with virtualization-based approaches.Further, the sandboxed application(s) and the unsandbox management codemay be included within the same Intel® SGX secure enclave, which mayimprove data protection and performance. Additionally, the integrity ofa sandboxed application and its unsandbox container may be attested andverified using SGX attestation, allowing a remote entity to verifyproper isolation and sandboxing.

The computing device 100 may be embodied as any type of computation orcomputer device capable of performing the functions described herein,including, without limitation, a computer, a desktop computer, aworkstation, a server, a laptop computer, a notebook computer, a tabletcomputer, a mobile computing device, a wearable computing device, anetwork appliance, a web appliance, a distributed computing system, aprocessor-based system, and/or a consumer electronic device. As shown inFIG. 1 , the computing device 100 illustratively includes a processor120, an input/output subsystem 126, a memory 128, a data storage device130, and a communication subsystem 132. Of course, the computing device100 may include other or additional components, such as those commonlyfound in a desktop computer (e.g., various input/output devices), inother embodiments. Additionally, in some embodiments, one or more of theillustrative components may be incorporated in, or otherwise form aportion of, another component. For example, the memory 128, or portionsthereof, may be incorporated in the processor 120 in some embodiments.

The processor 120 may be embodied as any type of processor capable ofperforming the functions described herein. The processor 120 may beembodied as a single or multi-core processor(s), digital signalprocessor, microcontroller, or other processor or processing/controllingcircuit. As shown, the processor 120 includes secure enclave support122, which allows the processor 120 to establish a trusted executionenvironment known as a secure enclave, in which executing code may bemeasured, verified, and/or otherwise determined to be authentic.Additionally, code and data included in the secure enclave may beencrypted or otherwise protected from being accessed by code executingoutside of the secure enclave. For example, code and data included inthe secure enclave may be protected by hardware protection mechanisms ofthe processor 120 while being executed or while being stored in certainprotected cache memory of the processor 120. The code and data includedin the secure enclave may be encrypted when stored in a shared cache orthe main memory 128. The secure enclave support 122 may be embodied as aset of processor instruction extensions that allows the processor 120 toestablish one or more secure enclaves in the memory 128. For example,the secure enclave support 122 may be embodied as Intel® Software GuardExtensions (SGX) technology.

As shown, the processor 120 also includes protection extensions 124. Theprotection extensions 124 allow the processor 120 to establish anenhanced memory segmentation model. In particular, in some embodimentsthe protection extensions 124 may support a low-latency segmentationmode with support for address translation and bounds checking in both32-bit and 64-bit modes. The protection extensions 124 also may supportpermissive segmentation in 32-bit mode (e.g., requiring segment base tobe zero and not performing limit checks). As described further below,the protection extensions 124 may also include support for isolatedexecution of applications or parts of applications (sandboxing), such ashardware support for enhanced task switching, call gate permissionchecks, protection domain switching, and/or control stack segmentchecking. In some embodiments, the protection extensions 124 may supportsegment-linked range registers and fast exception dispatch.

The memory 128 may be embodied as any type of volatile or non-volatilememory or data storage capable of performing the functions describedherein. In operation, the memory 128 may store various data and softwareused during operation of the computing device 100 such as operatingsystems, applications, programs, libraries, and drivers. As describedabove, the memory 128 may be divided logically by the processor 120 intoone or more segments, which may be used to isolate applications or othersoftware executed by the computing device 100. Additionally, part of thememory 128 may be used as an enclave page cache (EPC) to store encryptedcode and/or data for the secure enclaves established by the processor120. The processor 120 may encrypt memory pages of each secure enclavebefore transferring the encrypted pages out of the processor 120 to theEPC within the memory 128.

The memory 128 is communicatively coupled to the processor 120 via theI/O subsystem 126, which may be embodied as circuitry and/or componentsto facilitate input/output operations with the processor 120, the memory128, and other components of the computing device 100. For example, theI/O subsystem 126 may be embodied as, or otherwise include, memorycontroller hubs, input/output control hubs, platform controller hubs,integrated control circuitry, firmware devices, communication links(i.e., point-to-point links, bus links, wires, cables, light guides,printed circuit board traces, etc.) and/or other components andsubsystems to facilitate the input/output operations. In someembodiments, the I/O subsystem 126 may form a portion of asystem-on-a-chip (SoC) and be incorporated, along with the processor120, the memory 128, and other components of the computing device 100,on a single integrated circuit chip.

The data storage device 130 may be embodied as any type of device ordevices configured for short-term or long-term storage of data such as,for example, memory devices and circuits, memory cards, hard diskdrives, solid-state drives, or other data storage devices. Thecommunication subsystem 132 of the computing device 100 may be embodiedas any communication circuit, device, or collection thereof, capable ofenabling communications between the computing device 100 and otherremote devices over a network. The communication subsystem 132 may beconfigured to use any one or more communication technology (e.g., wiredor wireless communications) and associated protocols (e.g., Ethernet,Bluetooth®, Wi-Fi®, WiMAX, etc.) to effect such communication.

As shown, the computing device 100 may also include one or moreperipheral devices 134. The peripheral devices 134 may include anynumber of additional input/output devices, interface devices, and/orother peripheral devices. For example, in some embodiments, theperipheral devices 134 may include a display, touch screen, graphicscircuitry, keyboard, mouse, speaker system, microphone, networkinterface, and/or other input/output devices, interface devices, and/orperipheral devices.

Referring now to FIG. 2 , in an illustrative embodiment, the computingdevice 100 establishes an environment 200 during operation. Theillustrative environment 200 includes a segmentation manager 202, a taskmanager 204, a sandbox manager 206, a protection domain manager 208, acall segment manager 210, and a software isolation manager 212. Thevarious components of the environment 200 may be embodied as hardware,firmware, processor microcode, software, or a combination thereof. Assuch, in some embodiments, one or more of the components of theenvironment 200 may be embodied as circuitry or collection of electricaldevices (e.g., segmentation manager circuitry 202, task managercircuitry 204, sandbox manager circuitry 206, protection domain managercircuitry 208, call segment manager circuitry 210, and/or softwareisolation manager circuitry 212). It should be appreciated that, in suchembodiments, one or more of the segmentation manager circuitry 202, thetask manager circuitry 204, the sandbox manager circuitry 206, theprotection domain manager circuitry 208, the call segment managercircuitry 210, and/or the software isolation manager circuitry 212 mayform a portion of one or more of the processor 120, the I/O subsystem126, and/or other components of the computing device 100. Additionally,in some embodiments, one or more of the illustrative components may forma portion of another component and/or one or more of the illustrativecomponents may be independent of one another.

The segmentation manager 202 is configured to load a logical address.The logical address includes a segment base, an effective limit, and aneffective address. The segmentation manager 202 is further configured togenerate a linear address as a function of the logical address with theeffective limit as a mask. Generating the linear address includes, foreach bit of the logical address, selecting a corresponding bit from thesegment base or from the effective address based on a value of acorresponding bit from the effective limit. The segment base, theeffective limit, the effective address, and the linear address may eachbe embodied as 32-bit values or as 64-bit values.

The task manager 204 is configured to switch to a new task that isdescribed by a task state segment extension in the memory 128 of thecomputing device 100. The task manager 204 is further configured toactivate a low-latency segmentation mode in response to switching to thenew task if the task state segment extension is indicative of thelow-latency segmentation mode. The logical address may be loaded asdescribed above in connection with the segmentation manager 202 inresponse to activating the low-latency segmentation mode.

The sandbox manager 206 is configured to determine whether anapplication sandbox mode is enabled, to determine whether a destinationsegment for the new task is identified in a local descriptor table inresponse to determining that the application sandbox mode is enabled,and to determine whether the descriptor privilege level of thedestination segment is less than the current privilege level of theprocessor 120 in response to determining that the destination segmentfor the new task is identified in the local descriptor table. Thesandbox manager 206 is configured to generate an exception in responseto determining that the descriptor privilege level is less than thecurrent privilege level.

The software isolation manager 212 is configured to load an unsandbox214 in a user privilege level of the processor 120. The softwareisolation manager 212 is further configured to load, by the unsandbox214, a sandboxed application 216 in the user privilege level. Thesoftware isolation manager 212 is configured to configure, by theunsandbox 214, the task state segment extension. The new task describedby the task state segment extension is the sandboxed application 216.The software isolation manager 212 is configured to enable, by theunsandbox 214, the application sandbox mode and execute the sandboxedapplication 216 after enabling the application sandbox mode.

The software isolation manager 212 may be further configured to load ahost kernel in a supervisor privilege level of the processor 120. Thehost kernel loads a host application in the user privilege level, whichincludes the unsandbox 214. The software isolation manager 212 may befurther configured to load a secure enclave in the host applicationusing the secure enclave support 122 of the processor 120. The unsandbox214 and the sandboxed application 216 may be loaded in the secureenclave. The software isolation manager 212 may be further configured toattest to the secure enclave, which includes measuring a globaldescriptor table of the sandboxed application 216, measuring a localdescriptor table of the sandboxed application 216, and measuring thetask state segment extension.

The software isolation manager 212 may be further configured to load, bythe host application, a user-level virtual machine monitor and aparavirtualized kernel. The user-level virtual machine monitor includesthe unsandbox 214 and the paravirtualized kernel manages one or moresandboxed applications 216. The paravirtualized kernel is also sandboxedby the unsandbox 214. The user-level virtual machine monitor mayconfigure the task state segment extension. The software isolationmanager 212 may be further configured to handle, by the user-levelvirtual machine monitor, a virtualized system call from the sandboxedapplication 216 in the user privilege level. The software isolationmanager 212 may be configured to set a segmentation mode associated withthe host kernel to a permissive segmentation mode and to set, by thehost application, a segmentation mode associated with the task statesegment extension to the low-latency segmentation mode. The softwareisolation manager 212 may be configured to set a global descriptor tablebase of the host kernel and a global descriptor table bounds of the hostkernel to zero in response to setting the segmentation mode to thepermissive segmentation mode. The software isolation manager 212 may befurther configured to load, by the sandboxed application 216, a nestedsandboxed application 216 in the user privilege level, to configure, bythe sandboxed application 216, another task state segment extension thatdescribes a task associated with the nested sandboxed application 216,and to execute the nested sandboxed application 216.

As shown in FIG. 2 , in some embodiments the environment 200 may includethe protection domain manager 208. The protection domain manager 208 isconfigured to switch to a new protection domain. Each protection domainmay be embodied as a unit of code and data that may be used by multiplesoftware threads. The protection domain manager 208 is furtherconfigured to load a segmentation state of the processor 120 for the newprotection domain from a domain object segment. The segmentation statemay include a local descriptor table selector, a code segment selector,and an entry point instruction pointer. The protection domain manager208 is further configured to determine if a subsystem identifier of thedomain object segment is different from a current subsystem identifierof a current protection domain and to index a subsystem table in thememory 128 with the subsystem identifier to retrieve a subsystem tableentry in response to determining that the subsystem identifier of thedomain object segment is different from the current subsystemidentifier. The protection domain manager 208 is configured to load astack segmentation state from the subsystem table entry in response toindexing the subsystem table. The stack segmentation state may include astack segment selector and a stack pointer. The protection domainmanager 208 is configured to activate a low-latency segmentation mode ifthe subsystem table entry is indicative of the low-latency segmentationmode. The logical address may be loaded as described above in connectionwith the segmentation manager 202 in response to activating thelow-latency segmentation mode. The protection domain manager 208 may befurther configured to store a current stack pointer of the processor 120and/or a stack limit in the subsystem table in response to determiningthat the subsystem identifier of the domain object segment is differentfrom the current subsystem identifier.

As shown in FIG. 2 , in some embodiments the environment 200 may alsoinclude the call segment manager. The call segment manager 210 isconfigured to execute a call operation. The call operation is indicativeof a target code destination, and may be embodied as a near call, a farcall, or another instruction with call semantics. The call segmentmanager 210 is configured to push a call gate on a control stack inresponse executing the call operation. The call gate is indicative of areturn point associated with the call operation. The control stack isincluded in a control stack segment of the memory 128. The call segmentmanager 210 is further configured to execute a return operation inresponse to executing the call operation. The return operation may beembodied a near return, far return, or other instruction with returnsemantics. The call segment manager 210 is configured to determinewhether a return address of a legacy stack matches an address of a topcall gate of the control stack in response executing the returnoperation. In some embodiments, the call segment manger 210 may beconfigured to use only the address of the top call gate of the controlstack. The call segment manager 210 is configured to generate a controlstack mismatch exception in response to determining that the returnaddress of the legacy stack does not match the address of the top callgate of the control stack. The call segment manager 210 may be furtherconfigured to read a control stack segment mode from the subsystem tableentry in response to indexing of the subsystem table. The call segmentmanager 210 may be configured to push the call gate and to determinewhether the return address of the legacy stack matches the address ofthe top call gate for intra-domain transfers in response to determiningthat the control stack segment mode is an intra-domain transfer mode.

In some embodiments, the software isolation manager 212 may beconfigured to load the unsandbox 214 in a user privilege level of theprocessor 120; to load, by the unsandbox 214, the sandboxed application216 in the user privilege level; and to store, by the unsandbox 214, anextended descriptor selector in a code segment register of the processor120. The extended descriptor selector references an extended descriptorof an extended descriptor table. The sandbox manager 206 may beconfigured to enable an application sandbox mode of the processor 120 inresponse to storing the extended descriptor selector in the code segmentregister. The software isolation manager 212 may be further configuredto execute the sandboxed application 216 in response to enabling theapplication sandbox mode. The logical address may be loaded as describedabove in connection with the segmentation manager 202 in response toactivating the low-latency segmentation mode. The sandbox manager 206may be further configured to prohibit loading of a segment register ofthe processor 120 with a legacy descriptor selector in response toenabling the application sandbox mode. The legacy descriptor selectorreferences a legacy descriptor of a local descriptor table or a globaldescriptor table.

Referring now to FIG. 3 , in use, the computing device 100 may execute amethod 300 for application sandboxing using protection extensions. Itshould be appreciated that, in some embodiments, the operations of themethod 300 may be performed by one or more components of the environment200 of the computing device 100 as shown in FIG. 2 . The method 300begins in block 302, in which the computing device 100 loads a hostoperating system kernel in a supervisor mode of the processor 120. Thesupervisor mode may include any privileged operating mode, root mode, orother mode of the processor 120 in which the processor 120 may performsupervisory operations. For example, the host kernel may be loaded inring 0 for certain processors manufactured by Intel® Corporation. Inblock 304, the computing device 100 sets the segmentation mode of theprocessor 120 to a permissive mode. In the permissive mode, theprocessor 120 does not perform segment bounds checking. For example, thesegment base for every segment may be set to zero and the processor 120may not check the effective limits for each segment. The processor 120may be set to the permissive segmentation mode when operating in 32-bit,64-bit, or any other addressing mode. In block 306, the computing device100 sets the global descriptor table (GDT) segment base and bounds tozero. Thus, accesses to the GDT with the processor 120 in permissivesegmentation mode may be allowed, while accesses to the GDT with theprocessor 120 in another mode that enforces segmentation may generate ageneral protection fault or other exception. As described below,enforcing the GDT segment base and bounds may prevent access to the GDTfrom sandboxed applications.

In block 308, the computing device 100 loads a host application in auser mode of the processor 120. The user mode may include anynon-privileged operating mode of the processor 120 that may be managedby code executed in the supervisor mode. For example, the hostapplication may be loaded in ring 3 for certain processors manufacturedby Intel Corporation.

In block 310, the host application loads a secure enclave in the usermode. As described above, the secure enclave may be embodied as anencrypted, isolated segment of code and data that is not accessible byother software entities of the computing device 100. The secure enclaveis established and protected by the secure enclave support 122 of theprocessor 120. In particular, the contents of the secure enclave may beencrypted and stored in an enclave page cache included in the memory128. Thus, even privileged software of the computing device 100 such asthe host kernel may not access the contents of the secure enclave. Asdescribed above, the secure enclave may be established using Intel® SGXtechnology. Additionally or alternatively, in some embodiments, thesecure enclave may be established using another trusted executionenvironment, such as an ARM® TrustZone® secure world, a manageabilityengine, or other environment.

In block 312, the computing device enables SGX protection extensions.Enabling the protection extensions allows the processor 120 to performmemory segmentation translation and bounds checking for code executingin the secure enclave. In particular, enabling the protection extensionsmay allow segment bases to be set to a value other than zero and allowinstructions that manipulate segment registers other than FS and GS. Thesegment register state may also be measured and included wheneverenclave state is saved and restored. Additionally, enabling protectionextensions allows the EEXIT instruction to be executed only from withinthe unsandbox 214, because executing EEXIT from within a sandboxedapplication 216 could break the sandbox by, for example, specifying anarbitrary exitpoint and passing information through general-purposeregisters. In block 314, the computing device 100 may measure and attestthe secure enclave. As described above, the segment register state isincluded in the measurement of the secure enclave. Contents of datastructures defining the memory segmentation state such as the globaldescriptor table (GDT), local descriptor table (LDT), and task-statesegment (TSS) extensions are also included in the measurement. Verifyingthe attestation may allow a verifying entity to determine that aparticular unsandbox 214 is trusted.

In block 316, the computing device 100 loads a user-mode virtual machinemonitor (VMM) within the secure enclave. In the illustrative embodiment,the user-mode VMM is the unsandbox 214 and manages sandboxing for thesandboxed application(s) 216, as described further below. In block 318,the host kernel manages the memory of the user-mode VMM using paging.For example, memory accesses of the user-mode VMM may be regulated bypage tables managed by the host kernel. The user-mode VMM may be theonly entity of the host process to have its memory managed using paging.The user-mode VMM may execute in a permissive segmentation mode.

In block 320, the user-mode VMM loads a paravirtualized OS kernel, alsowithin the secure enclave. The paravirtualized OS kernel executes inuser mode, at a lower privilege level from the host kernel of thecomputing device 100. In the illustrative embodiment, theparavirtualized OS kernel and any processes managed by thatparavirtualized kernel are the sandboxed applications 216. Thus, thememory of the paravirtualized OS kernel and its sandboxed applicationsare managed using segmentation. The user-level OS kernel may beparavirtualized because in some embodiments the host VMM may haverestricted access to the guest, such as when the guest is an SGXenclave. The paravirtualized kernel itself has its memory managed usingsegmentation, which may prevent errant guest kernel accesses to guestprocess memory and allow faults generated by the guest kernel to beserviced in ring 3.

In block 322, the paravirtualized operating system kernel loads asandboxed application 216. As described further below, the sandboxedapplication 216 executes in user mode and is isolated from othersoftware executed by the computing device 100. The sandboxed application216 may be embodied as any user-level application, plug-in, server,process, thread, or other software executed by the computing device. Forexample, the sandboxed application 216 may be embodied as an applicationcontainer such as Docker or other user-mode process. The sandboxedapplication 216 may be capable of being executed outside of a sandboxwithout modification (i.e., the sandboxing may be transparent to thesandboxed application 216).

In block 324, the memory of the paravirtualized operating system kerneland the sandboxed application are managed using segmentation. Inparticular, the user-mode VMM may establish separate memory segments forthe paravirtualized kernel and any sandboxed applications 216, and maymanage segmentation-related faults and other exceptions generated by thesandboxed applications 216. The segmentation-related faults may behandled by the user-mode VMM in the user mode of the processor 120,which may prevent an expensive context switch to supervisor mode or anexit from the secure enclave. The user-mode VMM may manage segmentationby configuring LDTs, interrupt descriptor tables, segment registers,task-state segment extensions, and other segmentation control registersand data structures.

In block 326, the computing device 100 may configure a task statesegment (TSS) extension for the sandboxed application 216. The TSSextension may identify a particular LDT, code segment, stack segment,stack pointer, starting instruction pointer, and segmentation mode forthe sandboxed application 216. The TSS may be appended to or otherwiselocated with a legacy TSS readable by the processor 120. One potentialembodiment of a TSS extension is illustrated in FIG. 8 and describedfurther below.

In block 328, the computing device 100 enables sandbox mode for theprocessor 120. For example, the host kernel and/or host VMM may enableone or more model-specific registers of the processor 120. When thesandbox mode is enabled, the unsandbox 214 (e.g., the user-mode VMM) maysafely configure the LDT for the sandboxed application 216. Onepotential embodiment of a method for enforcing descriptor privilegelevels is described below in connection with FIG. 9 .

In block 330, the computing device 100 handles virtualized system callsfrom the sandboxed application 216 in user mode within the secureenclave. In particular, the processor 120 may support virtualizinginstructions that transfer control from user-level (e.g., ring 3)software to privileged (e.g., ring 0) software such as SYSCALL orSYSENTER. For example, to intercept SYSCALL, SYSTENTER, and otherinstructions that are not allowed in enclaves, a new type of exceptionmay be defined. The associated IDT entry would be configured to transfercontrol to the unsandbox 214. The processor 120 may replicate the MSRsthat control user to supervisor mode transitions so that the replicascontrol transitions from the sandboxed application 216 into theunsandbox 214. It may be unnecessary to provide special support fortransitioning from the unsandbox 214 into application sandboxes 216,since it may possible to simply traverse a TSS extension descriptor toperform that transition. However, it may be possible to improveperformance by defining new instructions to transition from theunsandbox 214 into application sandboxes 216. Handling the system callswithin the secure enclave may prevent expensive context switching out ofthe secure enclave and/or out of user mode. Thus, the computing device100 may support high-performance, transparent execution of the sandboxedapplication 216, because those SYSCALL and/or SYSENTER instructions maybe used to issue performance-critical system calls from within acontainerized application (e.g., from within a Docker container), andthose instructions are embedded in binary container images. Similarly,other programs may be distributed in binary form with embedded SYSCALLand SYSENTER instructions.

In block 332, the user-level application 216 executes within a sandbox.The application 216 is isolated from other applications and codeexecuted by the processor 120. The processor 120 prevents theapplication 216 from accessing code and/or data outside of the assignedsandbox, even in the presence of programming errors or maliciousexploits. In block 334, the computing device 100 uses enhanced taskswitching of the processor 120 to enter the application 216 in thesandbox. The computing device 100 may, for example, execute a jump,call, or other change of control flow instruction using the TSSextension configured as described above in connection with block 326.The processor 120 may configure the protection extensions 124 of theprocessor 120 based on the contents of the TSS extension and beginexecuting the sandboxed application 216. One potential embodiment of amethod for enhanced task switching is described below in connection withFIGS. 7 and 8 .

In block 336, the computing device 100 uses a low-latency segmentationmode to execute the sandboxed application 216. The low-latencysegmentation mode performs address translation and enforces segmentlimits. The low-latency segmentation mode provides sufficientperformance to enforce segmentation for 64-bit addressing modes. Onepotential embodiment of a method for low-latency segmentation isdescribed below in connection with FIGS. 5 and 6 .

In block 338, the computing device 100 virtualizes system callsgenerated by the sandboxed application 216. As described above inconnection with block 330, the processor 120 may support virtualizingSYSCALL, SYSENTER, or other system call instructions. The virtualizedsystem calls are handled by the user-level VMM and/or theparavirtualized kernel in user mode, without exiting the secure enclave.

In some embodiments, in block 340 the computing device 100 may establishadditional nested unsandboxes 214 and sandboxed applications 216 withinthe sandboxed application 216. The protection extensions 124 of theprocessor 120 are self-virtualizable, meaning that a sandboxedapplication 216 may be recursively split into a nested unsandbox 214 andcollection of sub-sandboxes 216 using the protection extensions 124.Thus, nested sandboxing may be provided without defining new protectionextensions for each nested level of sandboxing. The lower logicalringlevel is always responsible for informing the higher logicalringlevel of the TSS extension base addresses contained within the TSSdescriptors. Thus, the lower logical ringlevel may configure memorybounds to detect accesses to those memory regions and translate theminto modifications of shadow structures. This is analogous to the pagetable shadowing process that was used in VMMs prior to the introductionof nested paging. Lower logical ringlevels may add offsets to the basesof code and data descriptors installed by higher logical ringlevels tovirtualize them. The unsandbox 214 may copy the appropriate shadow TSSextensions to the actual TSS extension locations when entering avirtualized ringlevel, and may perform the inverse operation whenexiting it. Additionally, instructions that query information from thesegment descriptors loaded in segment registers into memory (e.g., LSL,LAR) may be prohibited in the sandboxed applications 216, to facilitateself-virtualization by hiding virtualized memory bounds from virtualizedsoftware.

After executing the sandboxed application 216, the method 300 loops backto block 322, in which the computing device 100 may load and executeadditional sandboxed applications 216.

Referring now to FIG. 4 , during execution of the method 300, thecomputing device 100 may establish a software environment 400. As shown,the environment 400 includes a host operating system kernel 402 thatexecutes in ring 0 of the processor 120. The host operating systemkernel 402 may execute multiple host applications 404. Each of the hostapplications 404 executes in ring 3, and may be embodied as any process,thread, or other code executed by the processor 120. As shown, one ormore of the host applications 404 may establish a secure enclave 406using the secure enclave support 122 of the processor 120. The code ofthe secure enclave 406 loads a user-mode VMM 408 and a paravirtualizedOS kernel 410. The paravirtualized OS kernel 410 may load one or moreapplications 412. As shown, the user-mode VMM 408 may perform thefunctions of the unsandbox 214, and the paravirtualized OS kernel 410and applications 412 may be the sandboxed application 216. Thus, theapplications 412 and the paravirtualized OS kernel may be protected fromeach other using memory segmentation managed by the user-level VMM 408(i.e., by the unsandbox 214). Additionally, the contents of theuser-mode VMM 408, the paravirtualized OS kernel 410, and theapplications 412 are protected by the secure enclave 406 from the hostapplications 404 and the host kernel 402 of the computing device 100.

It should be understood that in some embodiments, the computing device100 may perform application sandboxing using one or more alternativestructures. For example, in some embodiments, each sandboxed application216 may be included in a separate enclave 406 in a separate hostapplication 404. In those embodiments, rather than a user-level VMM 408and paravirtualized kernel 410, each secure enclave 406 may include ashim to direct requests to the host kernel 402 through a resourcemonitor in a separate secure enclave 406. Additionally or alternatively,the functionality of the resource monitor may be distributed across theprocesses, for example as part of the shim. Including each sandboxedapplication 216 in a separate secure enclave 406 may increase the numberof transitions across enclave boundaries.

Referring now to FIG. 5 , in use, the computing device 100 may execute amethod 500 for low-latency segmentation. It should be appreciated that,in some embodiments, the operations of the method 500 may be performedby one or more components of the environment 200 of the computing device100 as shown in FIG. 2 . The method 500 begins in block 502, in whichthe computing device 100 accesses a logical address in the low-latencysegmentation mode. As described above, a logical address identifies aparticular location in the memory 128 using a segmented memory model.The computing device 100 may access a logical address in response toexecuting a memory access instruction (e.g., a load, a store, a call, ajump, or a similar instruction) or another instruction that includes alogical address as a parameter. The computing device 100 may access thelogical address, for example, while executing a sandboxed application216 in the low-latency segmentation mode.

In block 504, the processor 120 reads a segment selector from a segmentregister of the processor 120. The segment register (e.g., CS, SS, DS,ES, FS, GS, or other register) may be determined based on theinstruction that generates the logical address access (e.g., based onthe instruction semantics or on a segment override prefix). The segmentselector may be embodied as, for example, a 16-bit value, a 32-bitvalue, or other value that may be used to locate a particular segment.In block 506, the processor 120 reads a segment descriptor identified bythe segment selector from a segment descriptor table. The particularsegment descriptor table may be identified by the segment selector. Forexample, a bit of the segment selector may identify whether to read fromthe global description table (GDT) or the local descriptor table (LDT),and a field of the segment selector may include an offset within thedescriptor table. Additionally or alternatively, in some embodiments theprocessor 120 may read the segment descriptor from an extendeddescriptor table (EDT), as described further below in connection withFIGS. 15 and 16 .

In block 508, the processor 120 loads an effective limit and segmentbase from the segment descriptor. Each of the effective limit and thesegment base may be embodied as 32-bit or 64-bit values, based on theoperating mode of the processor 120. Thus, the segment descriptor maysupport storage of the segment base and effective limit, even in 64-bitmode. For example, in code and data descriptors the final word mayspecify an additional 27 bits for the limit (excluding the 5 bit typefield that is required to be zeroed). Additionally, in some embodimentsthe processor 120 may cache the effective limit and the segment base toimprove performance, for example by storing those values in aninaccessible part of the corresponding segment register. Thus, theprocessor 120 may only read the segment descriptor when the segmentselector changes. In block 510, the processor 120 loads the effectiveaddress specified by the memory access instruction. For example, theeffective address may be included as an immediate value in theinstruction, stored in a register, stored in another memory location, orotherwise specified by the instruction.

In block 512, the processor 120 generates a linear address from thelogical address, using the effective limit as a mask. In particular, inblock 514 the processor 120 selects a bit from the segment base or theeffective address based on the value of a corresponding bit of theeffective limit. For example, if a bit of the effective limit is zero,the processor 120 may select the corresponding bit from the segmentbase, and if the bit of the effective limit is one, the processor 120may select the corresponding bit from the effective address. Theprocessor 120 may generate the linear address in hardware with lowlatency by using a bank of hardware multiplexers. By using the effectivelimit as a mask, the processor 120 may limit linear address accesses toa particular address range. For example, considering a 32-bit memoryaccess, if the most-significant 22 bits of the effective limit are setto zero and the least-significant 10 bits of the effective limit are setto one, the linear addresses may be restricted to a 1024-byte segment.

In block 516, the processor 120 accesses the linear address generatedbased on the logical address. The processor 120 may access the linearaddress through paging, for example by using a memory management unit toconvert the linear address into a physical address that may be used toaddress the memory 128. After generating the linear address access, themethod 500 is completed. The method 500 may be executed repeatedly bythe processor 120 for each logical address access. Thus, the method 500illustrates one potential embodiment of a low-latency segmentation modeof the processor 120. Compared to a legacy segmentation mode (e.g., theIA-32 segmentation model), the method 500 may avoid introducing a wideadder into the critical linear address computation path. In someembodiments, the processor 120 may employ a different low-latencysegmentation mode. For example, in some embodiments the processor 120may simply check single- or double-ended bounds, without performingaddress translation (e.g., with the segment base required to be zero).

The low-latency segmentation mode may be used, for example, as analternative way to enforce stack limits in both 32-bit and 64-bit modesto improve stack hardening for certain applications. Referring now toFIG. 6 , schematic diagram 600 illustrates one potential embodiment oflogical address translation that may be performed by the processor 120.The logical address translation may be performed in connection withblock 512 of FIG. 5 , described above. As described above, a logicaladdress includes an effective address and a segment selector, and thesegment selector may be used to determine a segment base and aneffective limit. Accordingly, the diagram 600 illustrates an effectivelimit 602, a segment base 604, and an effective address 606. As shown,each element of the logical address includes n bits, for example 32 bitsor 64 bits. Each bit of the effective limit 602 controls a correspondingmultiplexer 608, which may be embodied as a hardware element of theprocessor 120. Each bit of the segment base 604 and the effectiveaddress 606 are input to a corresponding multiplexer 608. For example,bits n−1 of the segment base 604 and the effective address 606 are inputto the multiplexer 608 a, which is controlled by the bit n−1 of theeffective limit 602; bits n−2 of the segment base 604 and the effectiveaddress 606 are input to the multiplexer 608 b, which is controlled bythe bit n−2 of the effective limit 602; and so on, up to bits 0 of thesegment base 604 and the effective address 606 that are input to themultiplexer 608 c, which is controlled by the bit 0 of the effectivelimit 602. Discarded (non-selected) bits from the effective address maybe required to have a particular value to avoid generating an exception.For example, all such bits may be required to have the value 0. Theprocessor 120 may generate an exception if any such bit has a disallowedvalue.

As shown, the outputs of the multiplexers 610 are combined to form alinear address 612. The values of the bits selected for the linearaddress 612 thus depend on the values of the corresponding bits of theeffective limit 604. In the illustrative example, the bits n−1 and n−2of the effective limit 604 are zero, causing the bits n−1 and n−2 of thelinear address 612 to be selected from the bits n−1 and n−2 of thesegment base 606. Further, the bit zero of the effective limit 604 isone, causing the bit zero of the linear address 612 to be selected fromthe bit zero of the effective address 608.

Referring now to FIG. 7 , in use, the computing device 100 may execute amethod 700 for task switching. It should be appreciated that, in someembodiments, the operations of the method 700 may be performed by one ormore components of the environment 200 of the computing device 100 asshown in FIG. 2 . The method 700 begins in block 702, in which thecomputing device 100 initiates a task switch. The computing device 100may initiate the enhanced task switch in response to executing a changeof control flow instruction (e.g., jump, call, return, or similarinstruction) or another instruction that identifies a task gate as aparameter. The computing device 100 may initiate the task switch, forexample, while entering execution of a sandboxed application 216 fromthe unsandbox 214, as described above in connection with block 332 ofFIG. 3 .

In block 704, the processor 120 determines whether enhanced segmentationmode is active. For example, the processor 120 may read one or moremodel-specific registers of the processor 120 to determine whetherenhanced segmentation mode has been enabled. In block 706, the processor120 checks whether enhanced segmentation mode is active. If not, themethod 700 branches to block 730 to perform a legacy task switch, asdescribed further below. If the enhanced segmentation mode is active,the method 700 advances to block 708.

In block 708, the processor 120 pushes the current value of the CSregister to the system stack if the task switch occurs during deliveryof an interrupt. The task switch may occur, for example, if an entry ofan interrupt descriptor table identifies the new task. The CS identifiesthe current code segment used by the processor 120, and storing thecurrent value on the stack may allow the processor 120 to resumeexecution after servicing the interrupt. In some embodiments, if a taskgate is referenced within the interrupt descriptor table (IDT) so that aTSS extension switch occurs during interrupt delivery, the current CSvalue must still be placed on the stack. The CS field in the TSSextension may not be updated by the processor 120, unlike the legacy32-bit TSS. However, the ESP/RSP field in the TSS extension is updatedto support re-entrancy into the task (if it is invoked later, that savedstack pointer will be used so that the existing contents of the stackare not overwritten). In those embodiments, the interrupt returninstruction (IRET) may be extended to comprehend this extended stackformat when enhanced segmentation is enabled and the Nested Task (NT)flag is set, indicating that a task gate was used to deliver theinterrupt.

In block 710, the processor 120 stores the current stack pointer (e.g.,ESP or RSP) to the task-state segment (TSS) extension for the currenttask. The current TSS extension may be identified, for example, by aregister of the processor 120 such as an enhanced segmentation taskregister (ESTR). Storing the current stack pointer may allow the task tobe re-entered without overwriting the contents of the stack.

In block 712, the processor 120 loads the ESTR with the address of a TSSextension for the new task. The TSS extension may be specified, forexample, by the task gate used to invoke the task switch. In block 714,the processor 120 reads the TSS extension referenced by the ESTR. Inblock 716, the processor 120 loads a segmentation state from the TSSextension referenced by the ESTR. In particular, the processor 120 mayload values from the TSS extension into the local descriptor table (LDT)pointer, the SS register, the CS register, the stack pointer register(e.g., ESP or RSP), and the instruction pointer register (e.g., EIP orRIP).

In block 718, the processor 120 sets a segmentation mode for theprocessor 120 based on the TSS extension. In particular, the processor120 may read one or more fields of the TSS extension to determine theappropriate segmentation mode. In some embodiments, in block 720 theprocessor 120 may activate a legacy segmentation mode. The legacysegmentation mode is compatible with certain legacy processorsmanufactured by Intel Corporation. In particular, for 32-bit memoryaccesses the legacy mode may perform logical-to-linear addresstranslation with segment limit checking, and for 64-bit memory accessesthe legacy segmentation mode may implement a flat, zero-based addressspace with no limit checking. In some embodiments, in block 722, theprocessor 120 may activate a permissive segmentation mode. Thepermissive segmentation mode implements a flat, zero-based address spacesimilar to the legacy segmentation mode for 64-bit memory accesses. Thepermissive segmentation mode ignores the segment base and does notperform segment limit checking. Thus, processes executing in permissivemode are allowed a full range of memory access to the associatedsegment. The permissive segmentation mode of the processor 120 may beactive in 32-bit or 64-bit address modes. In some embodiments, in block724, the processor 120 may activate a low-latency segmentation mode. Thelow-latency segmentation mode may perform logical-to-linear addresstranslation with segment limit checking using the effective limit as amask. Additionally, the low-latency segmentation mode may deny allmemory accesses to a segment with a base and limit pair set to zero. Thelow-latency segmentation mode is described further above in connectionwith FIGS. 5 and 6 .

In block 726, the computing device 100 executes the new task. Asdescribed above in connection with blocks 716, 718, the new task may beexecuted with a segmentation state and in a segmentation mode specifiedby the TSS extension. That segmentation state and segmentation mode mayenforce isolation of the new task from other entities of the computingdevice 100. For example, a sandboxed application 216 may be executed ina new task as described above in connection with block 332 of FIG. 3 .After switching to the new task, the method 700 is completed. The method700 may be executed repeatedly in response to the processor 120switching to new tasks.

Referring back to block 706, if the enhanced segmentation mode is notactive, the method 700 branches to block 728, in which the processor 120performs a legacy task switch using a task-state segment (TSS). Theprocessor 120 may perform a task switch compatible with certain legacyprocessors manufactured by Intel Corporation. In particular, theprocessor 120 may not access a TSS extension, and may always execute inlegacy segmentation mode (i.e., not in permissive mode or low-latencymode). After performing the legacy task switch, the method 700 advancesto block 726, in which the processor 120 executes the new task and themethod 700 is completed.

Referring now to FIG. 8 , schematic diagram 800 illustrates onepotential embodiment of a task state segment (TSS) extension 802. Theillustrative TSS extension includes values for the LDT register, the SSregister, the CS register, the ESP/RSP register, the EIP/RIP register,and the segmentation mode. All of the values of the TSS extension 802are static (i.e., pre-configured) except for the ESP/RSP register value,which is dynamic (i.e., stored by the processor 120 in response to anenhanced task switch).

Additionally or alternatively, in some embodiments, the processor 120may modify its behavior with respect to the task-state segment (TSS).For example, in some embodiments the processor 120 may not save orrestore all general-purpose registers when switching tasks. Thisbehavior may be disabled for all or a specified set of registers. Thatset may be specified, for example, by a global mode register or by a newbit or bitfield in each TSS structure. Legacy TSS switching currentlyrequires that all general-purpose registers be saved and restored whenswitching tasks. As another example, in some embodiments, the processor120 may treat EIP and/or some or all of the segment selectors in the TSSas static, rather than saving them when exiting a task. As anotherexample, in some embodiments the task gate descriptor may be extended topermit specifying an entrypoint, allowing the processor 120 to jump tomultiple entrypoints in a task. As another example, in some embodimentsthe I/O port permission bitmap of the TSS may be supplemented with acompact access control list (ACL) that maps from port numbers to aspecification of the privilege levels that are allowed to access them.That specification may take the form of a 4-bit map or a threshold, forexample. As another example, in some embodiments, the stack segments andstack pointers for the supervisory ring levels 0-2 or for some subset ofthose levels may be factored out of each TSS to a shared data structureor set of MSRs, which may be more space-efficient for multi-task systemswhere those values are the same for every task.

Referring now to FIG. 9 , in use, the computing device 100 may execute amethod 900 for call gate execution with privilege checking. It should beappreciated that, in some embodiments, the operations of the method 900may be performed by one or more components of the environment 200 of thecomputing device 100 as shown in FIG. 2 . The method 900 begins in block902, in which the computing device 100 executes a call gate. Thecomputing device 100 may execute the call gate in response to executinga change of control flow instruction (e.g., a jump, a call, a return, orother similar instruction) or another instruction that identifies thecall gate as a parameter. The computing device 100 may initiate the callgate, for example, from privileged code such as a host operating systemkernel or from unprivileged code such as an unsandbox 214 or sandboxedapplication 216.

In block 904, the processor 120 determines whether the process sandboxmode is enabled. The processor 120 may, for example, read one or moremodel-specific registers of the processor 120. In block 906, theprocessor 120 checks whether sandbox mode is enabled. If not, the method900 branches to block 920, described below. If the process sandbox modeis enabled, the method 900 advances to block 908.

In block 908, the processor 120 determines whether the destinationsegment of the call gate is in the local descriptor table (LDT). Forexample, the processor 120 may check a bit of the segment selector todetermine whether the segment descriptor is included in the LDT. Inblock 910, the processor 120 checks whether the destination segment isin the LDT. If not (e.g., if the destination segment is in the globaldescriptor table), the method 900 branches to block 920, describedbelow. If the descriptor is included in the LDT, the method 900 advancesto block 912.

In block 912, the processor 120 compares the descriptor privilege level(DPL) of the destination segment to the current privilege level (CPL).The privilege level, also called ring level, indicates the relativeprivilege level of a particular segment. The privilege level may varyfrom zero (the most privileged, typically used by a host operatingsystem kernel) to three (the least privileged, typically used byuser-level application code). The DPL may be included in a field of thesegment descriptor associated with the destination segment. The CPLrepresents the privilege level of the currently-executing code segmentand may be included in a hidden field of the CS register.

In block 914 the processor 120 determines whether DPL is less than CPL.If so, the method 900 branches to block 916, in which the processor 120generates a fault (e.g., a general protection fault or other exception).By generating the fault, the processor 120 may prevent less-privilegedcode from invoking a call gate from the LDT to more-privileged code.Accordingly, a user-level process may be allowed to modify entries inits own LDT. If the user-level process, for example as a result of aprogramming error or an attempted exploit, modifies the LDT to add acall gate to privileged code, the processor 120 generates a fault inresponse to an attempt to execute that call gate. Because the processor120 does not perform such fault checking for call gates included in theGDT, privileged software should maintain control over GDT entries. Thus,by performing that permission check, the computing device 100 may safelyallow unprivileged software (e.g., the unsandbox 214) to managesegmentation of other unprivileged software (e.g., the sandboxedapplication 216) using the LDT. Referring back to block 914, if DPL isnot less than CPL, the method 900 advances to block 918, in which theprocessor 120 allows the call gate to the destination segment. Aftergenerating the fault or allowing the destination segment, the method 900is completed.

Referring back to blocks 906, 910, if the process sandbox mode is notenabled or if the destination segment is not in the LDT, the method 900branches to block 920. In block 920, the processor 120 performs a legacycall gate permission check. After performing the legacy call gatepermission check, the method 900 is completed.

Referring now to FIG. 10 , in use, the computing device 100 may executea method 1000 for transferring between protection domains. It should beappreciated that, in some embodiments, the operations of the method 1000may be performed by one or more components of the environment 200 of thecomputing device 100 as shown in FIG. 2 . The method 1000 begins inblock 1002, in which the computing device 100 transfers to a newprotection domain. A protection domain represents a unit of code anddata that may be used by multiple software threads. Thus, eachprotection domain may represent a process such as a sandboxedapplication 216, a part of a process such as a function, or other unitof code. The computing device 100 may transfer to a new protectiondomain in response to executing a change of control flow instruction(e.g., a jump, a call, a return, or other similar instruction) oranother instruction that identifies the protection domain (or anassociated domain object segment) as a parameter. The computing device100 may transfer protection domains in addition to and/or instead ofperforming enhanced task switching with a TSS extension as describedabove in connection with FIGS. 7 and 8 .

In block 1004, the processor 120 uses a domain object segment (DOS)selector to load a new DOS for the new protection domain. Referring nowto FIG. 11 , diagram 1100 illustrates one potential embodiment of a DOS1102. As shown, the DOS 1102 includes 64-bit values for each of an LDTselector, a CS selector, a subsystem ID, and an entrypoint instructionpointer (IP). Referring back to FIG. 10 , in block 1006, the processor120 loads new values for the local descriptor table (LDT), CS register,and entrypoint IP (i.e., a new value for RIP) from the DOS. In block1008, the processor 120 determines whether the subsystem ID of the newdomain is different from the subsystem ID of the current protectiondomain. In block 1010, the processor 120 checks whether the new domainhas a new subsystem ID. If not, the method 1000 branches ahead to block1024, described below. If the new protection domain has a new subsystemID, the method 1000 advances to block 1012.

In block 1012, the processor 120 stores the current stack pointer value(RSP) into a subsystem table entry for the subsystem ID of the currentprotection domain. As described further below, the computing device 100may establish an environment table object segment (ETOS) in the memory128. The ETOS may include, among other data items, a subsystem tablethat includes entries for each subsystem ID in use by the computingdevice 100. Storing the RSP value in the subsystem table may allowmultiple protection domains in the same subsystem to share the samesystem stack, and for the subsystem to be reentrant. In someembodiments, in block 1014, the processor 120 may also store a stacklimit in the subsystem table. The stack limit may support limitedsharing of a single stack to prevent callers from performingunauthorized accesses into direct and indirect callers' stack frames.The limit specified on the control stack would be the limit in the SSregister at the time that control stack entry was created. It would berestored into SS when subsequently performing a return using thatcontrol stack entry. The limit specified on the subsystem table would beupdated when switching away from that subsystem by storing the currentvalue of the stack pointer. To pass parameters on the stack, the callerdomain may walk ESP back to a point above the parameters before callinganother domain. The SS requested privilege level could be set to thecurrent privilege level during task entry to permit stack sharing acrossprivilege levels.

In block 1016, the processor 120 indexes the subsystem table in the ETOSwith the new segment ID from the DOS. The processor 120 reads an entryfrom the subsystem table. Each entry in the subsystem table may includevalues for the SS selector, RSP, and segmentation mode for a subsystem.The values for the SS selector and the segmentation mode may be static,and the values for RSP may be dynamic (i.e., stored by the processor 120as described above in connection with block 1012). In block 1018, theprocessor 120 loads values for the SS register and the RSP register fromthe subsystem table entry for the new protection domain. In block 1020,the processor 120 sets the segmentation mode for the processor 120 basedon the value included in the subsystem table entry. As described abovein connection with block 718 of FIG. 7 , the segmentation mode may beset to the legacy segmentation mode, the permissive segmentation mode,or the low-latency segmentation mode.

In block 1022, the processor 120 sets a control stack segment (CSS) modeof the processor 120 based on a value from the subsystem table entry. Asdescribed further below in connection with FIGS. 12-14 , the CSS modemay allow tracking authorized return points and verifying changes incontrol flow executed by the processor 120. The CSS mode may allow theprocessor 120 to protect against certain return-oriented programming(ROP) attacks.

In block 1024, the processor 120 executes the new protection domain. Theprocessor 120 may begin execution at the instruction pointer (IP)address in the code segment identified by the DOS, using the stackpointer and stack segment identified in the subsystem table. Afterexecuting the new protection domain, the method 1000 is completed. Themethod 1000 may be executed by the processor 120 repeatedly, for examplewhen transferring between processes, functions, or other units of code.

Referring now to FIG. 12 , diagram 1200 illustrates an environment tableobject segment (ETOS) 1202 that may be used by the processor 120. TheETOS 1202 may be embodied as a segment of the memory 128. As shown, theETOS 1202 includes multiple special DOS selectors 1204, which eachidentify a particular domain object segment. The ETOS 1202 furtherincludes a subsystem table 1206. Each entry of the subsystem table 1206includes a SS selector, a dynamic RSP value, a segmentation mode, and 64reserved bytes for alignment purposes.

As shown, the ETOS 1202 also includes a control stack base selector anda control stack limit. The control stack base selector points to acontrol stack segment (CSS) 1208. The CSS 1208 may be embodied as asegment of the memory 128, and includes a control stack 1210 and acontrol stack pointer. Each entry of the control stack 1210 includes anSS selector, an RSP value, a CS selector, a DOS selector, and an RIPvalue. As described further below in connection with FIGS. 13 and 14 ,the control stack 1210 may be used to prevent certain return-orientedprogramming attacks.

Referring now to FIG. 13 , in use, the computing device 100 may executea method 1300 for executing a call with call segment stack checking. Itshould be appreciated that, in some embodiments, the operations of themethod 1300 may be performed by one or more components of theenvironment 200 of the computing device 100 as shown in FIG. 2 . Themethod 1300 begins in block 1302, in which the computing device 100executes a call instruction to a destination address. The computingdevice 100 may execute a legacy call instruction, an optimized callinstruction, or any other change of control flow instruction with callsemantics. The destination may be in the same protection domain as thecall instruction (a near call) or in a different protection domain (afar call).

In block 1304, the processor 120 determines whether an optimized nearcall instruction has been executed. If so, the method 1300 branchesahead to block 1314, described below. If an optimized near call has notbeen executed, for example if a legacy call instruction has beenexecuted, then the method 1300 advances to block 1306. In block 1306,the processor 120 updates the legacy stack segment (SS). The processor120 may, for example, push a return address onto the legacy stackidentified by the SS register and update the corresponding stack pointerRSP.

In block 1308, the processor 120 determines whether a far call has beenexecuted. The processor 120 may determine, for example, whether thedestination of the call instruction is within a different protectiondomain. If a far call has been executed, the method 1300 branches aheadto block 1314, described below. If a far call has not been executed(e.g., a legacy near call has been executed), then the method 1300advances to block 1310.

In block 1310, the processor 120 determines whether intra-domain controlstack segment (CSS) checking has been enabled. The particular CSSchecking mode may be specified in the active subsystem table entry inthe environmental table object segment (ETOS). For example, eachsubsystem table entry may include a field CSSMODE that may specify thatthe control stack is used only for inter-domain transfers or that thecontrol stack is also used for intra-domain transfers and checkedagainst the legacy stack. In some embodiments, the CSSMODE field mayalso specify that the control stack alone is used for intra-domaintransfers and that the legacy stack is not used. In block 1312, theprocessor 120 checks whether intra-domain CSS checking has been enabled.If not, the method 1300 branches to block 1320, in which the processor120 executes the call instruction to the destination address. Ifintra-domain CSS checking has been enabled, the method 1300 advances toblock 1314.

In block 1314, the processor 120 pushes a call gate for the returnaddress from the current call instruction on to the control stacksegment (CSS). The call gate may allow the processor 120 to properlyreturn to the instruction following the current call instruction and/orallow the processor 120 to validate the return address on the legacystack. The call gate may include the SS selector, RSP, CS selector, DOSselector, and RIP for the return address. In some embodiments, in block1316, the processor 120 may also store a stack limit from the SSregister into the CSS entry. The stack limit may be stored, for example,in a hidden part of the SS register. In some embodiments, in block 1318the processor 120 may generate a control stack overflow exception (#CSO)if the CSS is full. The processor 120 may determine whether the CSS isfull by comparing a control stack pointer to a control stack limitincluded in the ETOS. The processor 120 may generate the #CSO exceptionif there is only enough space left in the CSS for the #CSO interruptrecord itself.

In block 1320, the processor 120 executes the call to the destinationaddress. The processor 120 may transfer to a new protection domain, asdescribed above in connection with FIGS. 10-12 . After executing thecall, the method 1300 is completed. The processor 120 may execute themethod 1300 repeatedly in response to further call instructions.

Referring now to FIG. 14 , in use, the computing device 100 may executea method 1400 for executing a return with call segment stack checking.It should be appreciated that, in some embodiments, the operations ofthe method 1400 may be performed by one or more components of theenvironment 200 of the computing device 100 as shown in FIG. 2 . Themethod 1400 begins in block 1402, in which the computing device 100executes a return instruction to a return address. The computing device100 may execute a legacy return instruction, an optimized returninstruction, or any other change of control flow instruction with returnsemantics. The destination may be in the same protection domain as thereturn instruction (a near return) or in a different protection domain(a far return).

In block 1404, the processor 120 determines whether an optimized nearreturn has been executed. If so, the method 1400 branches ahead to block1418, described below. If an optimized near return has not beenexecuted, for example if a legacy return instruction has been executed,the method 1400 advances to block 1406. In block 1406, the processor 120determines whether a near return has been executed. The processor 120may determine, for example, whether the return address is within thesame protection domain as the return instruction. If a near return hasnot been executed (e.g., a legacy far return has been executed), themethod 1400 branches head to block 1412, described below. If a nearreturn has been executed, the method 1400 advances to block 1408.

In block 1408, the processor 120 determines whether intra-domain controlstack segment (CSS) checking has been enabled. As described above, theparticular CSS checking mode may be specified in the active subsystemtable entry in the environmental table object segment (ETOS). Forexample, each subsystem table entry may include a field CSSMODE that mayspecify that the control stack is used only for inter-domain transfersor that the control stack is also used for intra-domain transfers andchecked against the legacy stack. In some embodiments, the CSSMODE fieldmay also specify that the control stack alone is used for intra-domaintransfers and that the legacy stack is not used. In block 1410, theprocessor 120 checks whether intra-domain CSS checking has been enabled.If not, the method 1400 branches to block 1422, in which the processor120 executes the return instruction to the return address as describedfurther below. If intra-domain CSS checking has been enabled, the method1400 advances to block 1412.

In block 1412, the processor 120 compares the address of the top callgate in the CSS to the top return address of the legacy stack. Asdescribed above in connection with FIG. 13 , the processor 120 pushesthe same return address to the control stack in the CSS and to thelegacy stack. A mismatch could indicate that return-oriented programming(ROP) exploit has been attempted. In block 1414, the processor 120determines whether a mismatch exists between the return addresses of thecontrol stack in the CSS and the legacy stack. If not, the method 1400branches to block 1418, described below. If a mismatch exists, themethod 1400 advances to block 1416.

In block 1416, the processor 120 generates a control stack mismatchexception (#CSM). A service routine that handles the #CSM exception maydetermine whether the mismatch is benign or if the mismatch results froman attempted ROP attack. In response to a malicious attack, thecomputing device 100 may perform a security response such as reportingthe violation, terminating the process, or other policy-based response.Thus, after generating the control stack mismatch, the method 1400 maybe completed. In response to a benign violation, the service routine mayre-attempt the faulting return instruction or otherwise restartexecution.

In block 1418, the processor 120 pops the top call gate for the returnaddress from the control stack in the CSS. The processor 120 may also,for example, update a control stack pointer in the CSS. In someembodiments, in block 1420 the processor 120 may restore the stack limitstored in the control stack to the SS register.

In block 1422, the processor 120 updates the legacy stack segment SS.The processor 120 may read a legacy return address from the top of thestack and may also update the legacy stack pointer RSP. In block 1424,the processor 120 executes the return to the target return address. Theprocessor 120 may, for example, jump to the return address popped fromthe legacy stack or to the return address identified in the call gatepopped from the control stack. The processor 120 may also transition toa new protection domain as described above in connection with FIGS.10-12 . After executing the return, the method 1400 is completed. Theprocessor 120 may execute the method 1400 repeatedly in response tofurther return instructions.

Although illustrated as used in connection with protection domains, thecontrol stack and subsystem techniques of FIGS. 12-14 may be used evenif task-state segment (TSS) switching is still in use rather than theETOS/DOS approach described above. Each control stack entry may comprisethe TSS selector, the caller stack limit, and the caller EIP. Eachsubsystem table entry may comprise the stack segment selector and thestack limit.

Additionally or alternatively, SYSCALL and SYSENTER may be handledspecially. The processor 120 performs a far call through the SYSCALL orSYSENTER descriptor referred to by the appropriate field in the currentETOS. The processor 120 may only push a stack frame on the controlstack, not the legacy stack. The processor 120 may place the currentvalue of RFLAGS into R11 and then clear RFLAGS.IF and RFLAGS.VM. Inthose embodiments, SYSRET and SYSEXIT behave like IRET, except that theyonly pull data from the control stack and they retrieve RFLAGS from R11.

Referring now to FIG. 15 , in use, the computing device 100 may executea method 1500 for accessing an extended descriptor. It should beappreciated that, in some embodiments, the operations of the method 1500may be performed by one or more components of the environment 200 of thecomputing device 100 as shown in FIG. 2 . The method 1500 begins inblock 1502, in which the computing device 100 accesses a descriptor. Thecomputing device 100 may access a descriptor whenever accessing orotherwise referencing a segment, for example when loading a segmentregister or when processing a logical address.

In block 1504, the processor 120 determines whether the code segmentregister CS includes a selector for an extended descriptor. The registerCS may include a selector for an extended descriptor, for example, whenthe processor 120 is executing in sandbox mode. A legacy selector may beembodied as a 16-bit value including an offset that may be used to indexa descriptor table such as the global descriptor table (GDT) or a localdescriptor table (LDT). A selector for an extended descriptor may beembodied as a larger value (e.g., a 32-bit value) and may include afield indicating that the selector refers to an extended descriptor. Theselector may illustratively include a 15-bit protection domainidentifier (PDID) and an offset for a specific entry in an extendeddescriptor table (EDT). In block 1506, the processor 120 checks whetherthe CS register includes a selector for an extended descriptor. If not,the method 1500 advances to block 1508, in which the processor 120accesses a legacy descriptor, for example in the LDT or GDT. Afteraccessing the legacy descriptor, the method 1500 is completed.

Referring back to block 1506, if the CS register includes a selector foran extended descriptor, the method 1500 branches to block 1510. In block1510, the processor 120 prohibits loading a segment register oraccessing a call gate from any legacy descriptor table (e.g., the GDT,an LDT, or an interrupt descriptor table). In block 1512, the processor120 indexes a first-level extended descriptor table (EDT) with the PDIDfrom the extended selector. The processor 120 may access a first-levelassociated with the current processor privilege level (ring level). Theindexed entry in the first-level EDT may identify a second-level EDT forthe associated protection domain. The indexed entry in the first-levelEDT may also identify additional data, such as protection key register(PKR) values that may be associated with different protection domains.The PKR value in a first-level EDT entry may be loaded into the PKR whenthat first-level EDT entry is used to enter the corresponding protectiondomain.

In block 1514, the processor 120 indexes the second-level EDT with adescriptor offset from the extended selector. In block 1516, theprocessor 120 accesses the extended descriptor from the second-levelEDT. In some embodiments, the extended descriptor may be limited to oneof two types of descriptors: call gate descriptors and memory boundsdescriptors. After accessing the extended descriptor, the method 1500 iscompleted. Thus, the EDT may sandbox software by only allowing it to usedescriptors specifically allocated to it by the unsandbox 214 throughthe EDT or in segment registers that are preloaded at the time of thetransition into the sandboxed application 216. The only ways to exit thesandboxed application 216 may be through legacy interrupts, user modeinterrupts, or through an EDT call gate that references a legacy segmentdescriptor. It may also be necessary to shadow and attest to EDTcontents when they are used with SGX enclaves so that the enclave canmaintain control over them.

Referring now to FIG. 16 , diagram 1600 illustrates one potentialembodiment of an extended descriptor table (EDT). A set of extendeddescriptor table registers EDTR 1602 includes pointers for first-levelEDTs for each ringlevel of the processor. As shown, the value ofEDTR[ring] 1602 for the current ring level points to a first-levelextended descriptor table 1604, labeled EDT1. As shown, EDT1 may beindexed by a 15-bit PDID, allowing up to 32 k entries. Each entry mayinclude protection key register (PKR) values associated with thecorresponding protection domain. As shown, an entry in EDT1 points to asecond-level extended descriptor table 1606, labeled EDT0. EDT0 includesthe extended descriptors, which are illustratively call gate descriptorsor memory bounds descriptors only.

Referring back to FIG. 2 , as described above, the computing device 100establishes an environment 200 during operation that includes a sandboxmanager 206 and a software isolation manager 212. In some embodiments,the software isolation manager 212 may be configured to execute theunsandbox 214 in a privilege level of the processor 120 (e.g., in theuser privilege level or the supervisor level) and to enable, by theunsandbox 214, a sandbox mode of the processor 120. Enabling the sandboxmode may include setting a sandbox flag of the processor 120. Thesoftware isolation manager 212 is further configured to execute thesandboxed application 216 in the sandbox mode and in the same privilegelevel as the unsandbox 214. The software isolation manager 212 may befurther configured to execute, by the unsandbox 214, a dispatch handlerin the same privilege level in response to a dispatch of a sandboxexception, as described further below. The software isolation manager212 may be configured to execute a dispatch return instruction (DISPRET)after handling the dispatch of the sandbox exception.

In some embodiments, the sandbox manager 206 may be configured togenerate a sandbox exception in response to executing the sandboxedapplication 216 and to dispatch the sandbox exception to the sandboxexception handler of the unsandbox 214. The sandbox manager 206 isfurther configured to resume execution of the sandboxed application 216in the sandbox mode and in the same privilege level in response toexecuting the user mode interrupt return instruction.

In some embodiments, the software isolation manager 212 may be furtherconfigured to configure, by the unsandbox 214, one or more rangeregisters that are each linked to a segment register of the processor120. In those embodiments, dispatching the sandbox exception may includedispatching a segment range sandbox violation in response to determiningthat a linear address of a memory access is not within the memory boundsdefined by the associated range register. The software isolation manager212 may be further configured to load a host kernel in a supervisorprivilege level of the processor and to load, by the host kernel, a hostapplication in the user privilege level. The software isolation manager212 may be further configured to load a secure enclave in the hostapplication using the secure enclave support 122 of the processor 120.The software isolation manager 212 may be further configured to load, bythe host application, a user-level virtual machine monitor that includesthe unsandbox 214 and to load, by the user-level virtual machinemonitor, a user-level paravirtualized kernel that includes the sandboxedapplication 216.

Referring now to FIG. 17 , in use, the computing device 100 may executea method 1700 for executing a sandboxed application. It should beappreciated that, in some embodiments, the operations of the method 1700may be performed by one or more components of the environment 200 of thecomputing device 100 as shown in FIG. 2 . The method 1700 begins inblock 1702, in which the computing device 100 starts executing auser-mode sandboxed application 216 in a sandbox. The computing device100 may, for example, enable a sandbox mode of the processor 120 usingthe unsandbox 214 and then begin executing the sandboxed application 216in the sandbox mode. The unsandbox 214 may enable the sandbox mode byenabling one or more control registers established by the processor 120.For example, the unsandbox 214 may set a global sandboxing enable flagsuch as a SANDBOX_EN flag of the CR4 configuration register, as well asa mode-specific enable flag such as a SANDBOX flag of a user-levelSANDBOX_CTL_U register. One potential embodiment of sandbox controlregisters that may be established by the processor 120 is describedbelow in connection with FIG. 18 .

In block 1704, the sandboxed application 216 generates a sandboxexception during execution. The sandbox exception may be embodied as anyviolation, trap, error, or other exceptional circumstance generated bythe sandboxed application 216 that may be handled by the unsandbox 214.For example, the sandbox exception may be a segment-linked rangeregister (SLRR) bound violation as described further below in connectionwith FIGS. 19-20 , a process or thread switch exception as describedfurther below in connection with FIG. 21 , a shadow stack mismatchviolation as described further below in connection with FIGS. 22-24 , asystem call exception as described further below in connection with FIG.25 , or any other exceptional circumstance.

In block 1706, in response to the sandbox exception, the processor 120stores sandbox exception dispatch values into a set of shared registersof the processor 120. The sandbox dispatch registers of the processormay be managed similarly to, for example, VT-x VMCS exit informationfields used for VMExits to a root virtual machine monitor (VMM). Inblock 1708, the processor 120 stores a return address pointing to alocation within the sandboxed application 216. As described furtherbelow, after handling the sandbox exception, the computing device 100may resume executing the sandboxed application 216 at the returnaddress. In block 1710, the processor 120 stores a copy of a flagsregister of the processor 120. For example, the processor 120 may storea copy of the RFLAGS register. The flags register may be restored whenresuming execution of the sandboxed application 216. In someembodiments, in block 1712 the processor 120 may store a dispatchaddress based on the particular sandbox exception that was generated. Insome embodiments, in block 1714 the processor 120 may storequalification data based on the particular sandbox exception that wasgenerated. The semantics of the dispatch address and/or thequalification data depends on the particular sandbox exception that wasgenerated. One potential embodiment of shared sandbox dispatch registersthat may be established by the processor 120 is described below inconnection with FIG. 18 .

In block 1716, the processor 120 clears the sandbox flag of a controlregister of the processor 120. For example, the processor 120 mayautomatically clear the SANDBOX flag of the user-level SANDBOX_CTL_Uregister. Clearing the sandbox flag disables the sandbox mode and, forexample, may disable SLRR bounds checking. In block 1718, the processor120 jumps to an exception handler in the unsandbox 214. The particularaddress of the exception handler may be identified by a configurationregister of the processor 120 associated with the particular sandboxexception that was generated. The processor 120 may perform a near jumpto the exception handler; that is, the processor 120 may jump to theexception handler without modifying the segmentation state (or taskstate) of the processor 120.

In block 1720, the exception handler of the unsandbox 214 handles thesandbox exception. The unsandbox 214 executes with the sandbox modedisabled, and thus may be capable of configuring sandbox controlregisters or otherwise managing the sandboxed application 216. Thus, theunsandbox 214 may perform any appropriate management, policy, security,or other actions in response to the sandbox exception. For example, theunsandbox 214 may update configuration registers or otherwise correctthe conditions that caused the sandbox exception, perform an operationrequested by the sandboxed application 216, perform a security operationor other policy-based action, or perform other exception handlingoperations. Particular examples of sandbox exceptions and exceptionhandlers are described further below in connection with FIGS. 19-25 .

In block 1722, after handling the sandbox exception, the unsandbox 214executes a dispatch return (DISPRET) instruction to return to thesandboxed application 216 at the stored return address. The DISPRETinstruction may set the sandbox flag, restore the flag register of theprocessor 120, jump to the stored return address, and perform any otherappropriate operations to resume execution of the sandboxed application216. After resuming execution of the sandboxed application 216, themethod 1700 loops back to block 1704 to handle further sandboxexceptions. Additionally, although illustrated as returning to thesandboxed application 216, it should be understood that in someembodiments the unsandbox 214 may terminate the sandboxed application216 in response to the sandbox exception, thereby ending the method1700.

Additionally, although illustrated as executing the unsandbox 214 andthe sandboxed application 216 in the user privilege level of theprocessor 120, it should be understood that in some embodiments theunsandbox 214 and the sandboxed application 216 may execute in thesupervisor privilege mode of the processor 120. To support user andsupervisor mode sandboxing, the processor 120 may provide a set ofsandbox configuration registers for each of the user and the supervisormode. Supervisor mode sandboxing may not be inherently impervious tobreaches, since supervisor mode software can access many namespaces overwhich the sandbox exerts no control. For example, sandboxed supervisormode software could manipulate paging to arbitrarily redirect memoryaccesses. However, the sandboxing support of the computing device 100may make breaching a sandbox more difficult or complicated and may limitthe effects of programming errors or exploits in supervisor modesoftware in certain usages.

Referring now to FIG. 18 , diagram 1800 illustrates one potentialembodiment of sandbox configuration registers that may be established bythe processor 120. As shown in the diagram 1800, the processor 120illustratively establishes a CR4.SANDBOX_EN flag 1802 of theconfiguration register CR4. The CR4.SANDBOX_EN flag 1802 is a globaloverride flag that determines whether sandbox mode may be enabled by theprocessor 120. CR4 is automatically managed during transitions to andfrom VMX-root mode and SMM. The processor 120 also establishes a SANDBOXflag of a SANDBOX_CTL_U register 1804 and a SANDBOX flag of theSANDBOX_CTL_S register 1806. The SANDBOX flags of the registers 1804,1806 enable sandbox mode for user-mode code and supervisor-mode code,respectively. Sandboxed software is not allowed to access anyconfiguration registers for sandboxed features or the sandboxingframework itself. Whatever enhanced monitoring is defined by sandboxedfeatures is temporarily disabled in the unsandbox (e.g., when theSANDBOX flag is disabled). As shown, the processor 120 also establishesfour additional registers 1808 to 1814. Each of the registers 1808 to1814 is a 64-bit value, and there is a set of registers 1808 to 1814 foreach of the user mode and the supervisor mode. TheSANDBOX_DISP_RET_IP_U/S register 1808 includes a return address withinthe sandboxed application 216 that may be used to re-enter the sandboxedapplication 216. The SANDBOX_DISP_FLAGS_U/S register 1810 includes thesaved value of the processor 120 flags register (e.g., the RFLAGSregister). The SANDBOX_DISP_ADDR_U/S register 1812 and theSANDBOX_DISP_QUAL_U/S register 1814 include a dispatch address anddispatch qualification data, respectively. The particular data stored inthe registers 1812, 1814 depends on the particular sandbox exceptionthat is being dispatched. Alternately, separate, non-shared registerscould be defined for each type of information provided to exceptionhandlers.

The set of supervisor mode registers may be configured using MSRs, andthe set of user mode registers may be configured with a user-modeinstruction set architecture. For example, the user mode registers maybe configured with a user mode-accessible ISA analogous to RDMSR/WRMSR.Because user mode software is able to configure these new featureswithout intervention from supervisor mode, a relying party can verifythat proper sandboxing is being enforced within an SGX enclave based onan attestation of the enclave. As described further below, the sandboxconfiguration may be saved and restored using the XSAVE feature. Supportfor the sandboxing framework and each sandboxed feature may beenumerated using the CPUID instruction.

Referring now to FIG. 19 , in use, the computing device 100 may executea method 1900 for enforcing segment-linked memory bounds. The SLRRframework described in FIG. 19 is built on generic sandboxing frameworkdescribed above in connection with FIGS. 17-18 , and may providelow-latency bounds-checking support in both 32-bit and 64-bit mode,low-overhead bounds updates, and acceptable energy efficiency. It shouldbe appreciated that, in some embodiments, the operations of the method1900 may be performed by one or more components of the environment 200of the computing device 100 as shown in FIG. 2 . The method 1900 beginsin block 1902, in which the unsandbox 214 of the computing device 100configures memory bounds defined by one or more segment-linked rangeregisters (SLRRs) of the processor 120. Each SLRR is associated with asegment register of the processor 120 (e.g., CS, SS, DS, etc.) anddefines a contiguous range of linear addresses that are allowed to beaccessed by the sandboxed application 216 through the correspondinglogical segment. Each SLRR may also be associated with read and/or writepermissions, and in some embodiments may be enabled or disabled. In someembodiments, there may be one SLRR linked to each segment register;however; in other embodiments one or more SLRRs may be assigned to eachsegment register. One potential embodiment of SLRRs is described belowin connection with FIG. 20 . In block 1904, the computing device 100starts executing the user-mode sandboxed application 216 in the sandbox.As described above in connection with block 1702 of FIG. 17 , theunsandbox 214 may enable the sandbox mode and then start execution ofthe sandboxed application 216.

In block 1906, the sandboxed application 216 accesses a logical addressin the memory 128. The logical address is associated with a segmentregister of the processor 120 (e.g., CS, SS, DS, etc.). The logicaladdress may include a segment selector (stored in the associated segmentregister), an effective address (offset), and an effective limit. Theprocessor 120 may access the logical address in a 32-bit mode or a64-bit mode. In block 1908, the processor 120 maps the logical addressto a linear address in the memory 128. The linear address is a virtualaddress in a flat (linear) memory space, and may be embodied as a 32-bitor a 64-bit address. The processor 120 may perform a legacy mapping ofthe logical address to the linear address; for example, in 64-bit modethe segment base may be zero and the effective limit may not be checked.

In block 1910, the processor 120 determines whether the linear addressis out of bounds established by an SLRR linked to the segment registerof the logical address. For example, if the logical address is linked tothe CS register, the processor 120 may check the linear address againstbounds established by an SLRR_CS register, if the logical address islinked to the SS register, the processor 120 may check the linearaddress against bounds established by an SLRR_SS register, and so on.Each SLRR may include fields to establish an upper and a lower bound,and the processor 120 may determine whether the linear address is out ofbounds by performing comparisons against those fields. In someembodiments, in block 1912, the processor 120 may also check whetheraccess is allowed by permissions associated with the SLRR. For example,a separate configuration register SLRR_CFG may define read and writepermissions for each segment register. The processor 120 may also beconfigured to only allow execute (instruction fetch) access to the codesegment (i.e., the CS register) and to deny execute access for logicaladdresses associated with other segment registers.

In block 1914, the processor 120 checks whether the linear address isallowed. If so (e.g., if in-bounds and allowed by the appropriatepermissions), the method 1900 branches ahead to block 1924, describedbelow. If the linear address is not allowed (i.e., if the address isout-of-bounds or not allowed by the appropriate permissions), the method1900 advances to block 1916.

In block 1916, the processor 120 dispatches an SLRR bounds violation toa bounds violation handler of the unsandbox 214. The processor 120dispatches the violation using the sandbox exception dispatch methoddescribed above in connection with FIGS. 17-18 . In block 1918, theprocessor 120 sets the dispatch address register (e.g.,SANDBOX_DISP_ADDR_U) to the linear address of the attempted access. Inblock 1920, the processor 120 sets the dispatch qualification dataregister to identify the segment register of the logical address (e.g.,CS, SS, DS, etc.). In block 1922, the processor 120 jumps to an SLRRbounds handler in the unsandbox 214 that is identified in aconfiguration register of the processor 120 (e.g., SLRR_BNDV_IP). Afterjumping to the SLRR bounds handler, the unsandbox 214 may handle thebounds violation by, for example, adjusting the SLRR bounds linked tothe segment register, modifying the logical address or other datastructures, servicing a request associated with the linear address, orotherwise processing the exception. In some embodiments, the unsandbox214 may report a potential security violation, terminate the sandboxedapplication 216, or perform another security response. As anotherexample, in some embodiments the unsandbox 214 may support discontinuousmemory ranges (similar to paging) by updating the appropriate SLRR tocover the needed range. After the unsandbox 214 exception handlercompletes processing, the computing device 100 resumes executing thesandboxed application 216, as described above.

In block 1924, the sandboxed application 216 of the computing device 100accesses the linear address in the memory 128. The linear address isthus accessed after it is determined to be within the bounds establishedby the corresponding SLRR (or after the SLRR bounds have been adjustedby the exception handler). Thus, the computing device 100 may enforcememory isolation between the sandboxed application 216 and otherprocesses of the computing device 100 in an efficient manner, withoutrequiring the processor 120 to change between modes or privilege levels.After accessing the linear address, the method 1900 loops back to block1906, in which the sandboxed application 216 may access additionallogical addresses.

Referring now to FIG. 20 , diagram 2000 illustrates one potentialembodiment of segment-linked range registers (SLRRs) that may beestablished by the processor 120. A single SLRR includes an SLRR_xx.LBlower bound field 2002 and an SLRR_xx.UB upper bound field 2004. Each ofthe lower bound and upper bound fields 2002, 2004 include a 64-bitlinear address that establishes the lower bound and upper bound,respectively, of a contiguous range of linear addresses that may beaccessed through the corresponding segment register. Each segmentregister may be associated with a specific SLRR. For example, CS may beassociated with SLRR_CS.LB and SLRR_CS.UB, SS may be associated withSLRR_SS.LB and SLRR_SS.UB, and so on. The processor 120 may alsoestablish a 64-bit SLRRCFG register 2006, which may be used to configurepermissions for each segment register. The SLRRCFG register 2006 mayinclude a write enable bit for each segment register (e.g., W_SS, W_CS,etc.) and a read enable bit for each segment register (e.g., R_SS, R_CS,etc.). The SLRRCFG register 2006 may not include execute-enable bitsbecause code may only be executed through the CS register. The SLRRCFGregister 2006 may also include a valid bit for each segment register(e.g., V_SS, V_CS, etc.), which may determine whether SLRR checking isperformed for that segment register. As shown, the processor 120 alsoestablishes a SLRR_BNDV_IP register 2008, which may include the 64-bitlinear address of the bounds violation exception handler in theunsandbox 214. As shown, during exception dispatch the linear baseaddress of the attempted access is stored in the SANDBOX_DISP_ADDRregister 1812 and an identifier of the segment register is stored in thelower 3 bits of the SANDBOX_DISP_QUAL register 1814. The consolidatedSLRRCFG register may support efficient bulk updates of the SLRRs enablestatus and permissions. The processor 120 may also define a new bit(SLRR_EN) in CR4 that can override the valid bits in SLRRCFG to disableSLRR checking when SLRR_EN is cleared.

Thus, to transition from the sandboxed application 216 to the unsandbox214 using SLRR bound checking, the sandboxed application 216 mayintentionally attempt to access code or data outside the bounds of theSLRRs. That access will generate an SLRR bounds violation to theunsandbox 214. The effect of this is logically similar to the effect ofperforming a SYSCALL instruction to transition from user mode tosupervisor mode. Alternately, a new or existing instruction such asSYSCALL may be defined to invoke the unsandbox when executed in sandboxmode.

Referring now to FIG. 21 , in use, the computing device 100 may executea method 2100 for switching between threads. It should be appreciatedthat, in some embodiments, the operations of the method 2100 may beperformed by one or more components of the environment 200 of thecomputing device 100 as shown in FIG. 2 . The method 2100 begins inblock 2102, in which the processor 120 of the computing device 100dispatches a thread switch exception to the unsandbox 214. The threadswitch exception may be generated in response to any request to switchthreads or processors or in response to any other thread switchingevent. For example, the sandboxed application 216 may intentionallyaccess a predetermined memory location that is outside the bounds of theSLRRs in order to cause the exception to be dispatched to the unsandbox214. The computing device 100 executes an appropriate thread switchhandler of the unsandbox 214 with the sandbox mode disabled. Theunsandbox 214 may identify the current thread as well as a destinationthread that will be switched to.

In block 2104, the computing device 100 saves the current thread sandboxconfiguration by executing the XSAVE instruction. The XSAVE instructionsaves a large amount of processor 120 state into an XSAVE area in thememory 128. The XSAVE instruction may save, for example, sandboxconfiguration registers such as CR4.SANDBOX_EN, SANDBOX_CTL_U,SANDBOX_DISP_RET_IP_U, and SANDBOX_DISP_FLAGS_U, as well as otherprocessor 120 state such as floating point register state, MMX registerstate, or other register state.

In block 2106, the computing device 100 re-enables the sandbox flag(e.g., SANDBOX_CTL_U.SANDBOX) in the saved data in the XSAVE memory areafor the destination thread. Because the sandbox state data for thedestination thread was saved during execution of the unsandbox 214 asdescribed above in connection with block 2104, the sandbox flag asstored in the XSAVE memory area is cleared. In block 2108, the computingdevice 100 restores the sandbox configuration for the destination threadby executing the XRSTOR instruction. The XRSTOR instruction loads thesaved state data from the XSAVE memory area into the appropriateregisters of the processor 120. Because the sandbox flag was enabled asdescribed above in connection with block 2106, the sandbox configurationis restored into the enabled state. In block 2110, the computing device100 completes the switch to the destination thread. In particular, thecomputing device 100 starts executing the destination thread in thesandbox mode.

Referring now to FIG. 22 , diagram 2200 illustrates one potentialembodiment of a memory layout for shadow stack support that may beprovided by the computing device 100. As described above, a shadow stackmay provide protection against return-oriented programming (ROP)exploits and other potential malware. The diagram 2200 shows that thememory 128 of the computing device 100 may be divided into a shadowstack 2202, an unsandbox code/data range 2204, a stack segment 2206, anda code/data segment 2208. The computing device 100 further establishesan SLRR_SS register that defines valid memory bounds in the stacksegment 2206 and a SLRR_CS register that defines valid memory bounds inthe code/data segment 2208. All other SLRRs may be configured to coversome or all of the same range as SLRR_CS. Alternately, SLRR_CS may justcover executable code within the code/data segment 2208, and other SLRRs(besides SLRR_SS) may cover all or a subset of the code/data segment2208. The sandboxed application 216 may execute within the code/datasegment 2208 (e.g., referencing the RIP register) and use the stacksegment 2206 (e.g., referencing the RSP register) and thus may belimited to accessing memory within the bounds defined by SLRR_CS andSLRR_SS. As shown in FIG. 22 , the shadow stack 2202 is outside of thebounds of any SLRR and thus may not be accessed by software executing inthe sandbox mode. Rather, the processor 120 may directly update theshadow stack 2202 in response to near call instructions and near returninstructions, as described further below. Accesses to the shadow stack2202 by the processor 120 do not check the SLRRs. Similarly, theunsandbox 214 executes with sandbox mode disabled and thus the SLRRs arealso not checked. Accordingly, the unsandbox 214 may access theunsandbox code/data range 2204 as well as the shadow stack 2202. Theunsandbox 214 thus may manage, analyze, or otherwise process thecontents of the shadow stack 2202, for example by executing “ROPdetector” software to identify and mitigate return-oriented programmingattacks. Shadow stack checking may be enabled and otherwise controlledby the unsandbox 214 using one or more control registers as describedbelow in connection with FIG. 24 .

Referring now to FIG. 23 , in use, the computing device 100 may executea method 2300 for executing a near return instruction. It should beappreciated that, in some embodiments, the operations of the method 2300may be performed by one or more components of the environment 200 of thecomputing device 100 as shown in FIG. 2 . The method 2300 begins inblock 2302, in which the processor 120 of the computing device 100executes a near return instruction with the sandbox mode enabled andwith shadow stack checking enabled. A near return instruction performs areturn to a return address in the same code segment as the returninstruction, without requiring the processor 120 to change modes.

In block 2304, the processor 120 determines whether the return addresson the top of the legacy stack matches the top return address of theshadow stack. The legacy stack is included in the SS segment and ispointed to by the processor 120 stack pointer (e.g., RSP). As describedabove in connection with FIG. 22 , the shadow stack is included in thememory 128 outside of any valid bounds defined by an SLRR. The top ofthe shadow stack may be pointed to by a field of a specialized registerof the processor 120 such as SHADOW_STK_U.PTR (for user-mode code) orSHADOW_STACK_S.PTR (for supervisor-mode code). Each entry of the shadowstack is precisely 64 bits in length and thus the shadow stack pointermay be 64-bit aligned in memory. The processor 120 accesses the shadowstack without performing any SLRR bounds checking.

In block 2306, the processor 120 determines whether a mismatch has beenfound between the legacy stack and the shadow stack. Such a mismatch mayindicate that the legacy stack has been corrupted, for example as theresult of a programming error, a stack overflow exploit, a ROP exploit,or other exploit. If no mismatch exists, the method 2300 branches aheadto block 2316 to perform the near return, as described below. If amismatch exists, the method 2300 advances to block 2308.

In block 2308, the processor 120 dispatches a stack mismatch violationto a stack mismatch violation handler of the unsandbox 214. Theprocessor 120 dispatches the violation using the sandbox exceptiondispatch method described above in connection with FIGS. 17-18 . Inblock 2310, the processor 120 sets the dispatch address register (e.g.,SANDBOX_DISP_ADDR_U) to the legacy return address from the legacy stack.In block 2312, the processor 120 sets the dispatch qualification dataregister to the shadow return address from the shadow stack. In block2314, the processor 120 jumps to stack mismatch handler in the unsandbox214 that is identified in a configuration register of the processor 120(e.g., SHADOW_STK_MISM_IP_U). After jumping to the stack mismatchhandler, the unsandbox 214 may handle the stack mismatch violation byanalyzing the legacy and/or shadow stacks in order to determine whetherthe mismatch was caused by a potential exploit or by benign behavior.For example, setjmp/longjmp and C++ exceptions may cause deviations froma strict call/return model of control flow and should be permitted. Insome embodiments, the unsandbox 214 may report a potential securityviolation, terminate the sandboxed application 216, or perform anothersecurity response. After the unsandbox 214 exception handler completesprocessing, the computing device 100 resumes executing the sandboxedapplication 216, as described above.

In block 2316, the processor 120 performs the near return. The processor120 may pop the top entry from both the shadow stack and the legacystack, and then jump to the return address popped from the legacy stack.After performing the near return, the method 2300 is completed. Thecomputing device 100 may execute the method 2300 again in response toadditional near return instructions.

Referring now to FIG. 24 , diagram 2400 illustrates one potentialembodiment of shadow stack configuration registers that may beestablished by the processor 120. As shown in the diagram 2400, theprocessor 120 illustratively establishes a CR4.SHADOW_STK_EN flag 2402of the configuration register CR4. The processor 120 establishes ashadow stack register that includes a SHADOW_STK_U/S.PTR field 2406, anupper bound SHADOW_STK_U/S.UB field 2408, and a lower boundSHADOW_STK_U/S.LB field 2410. The SHADOW_TK_U/S.PTR field 2406 includesthe linear address of the top of the shadow stack. As shown, the shadowstack pointer is 64-bit aligned in memory and thus the lower 3 bits arereserved or must be zero. The SHADOW_STK_U/S.UB field 2408 and the lowerbound SHADOW_STK_U/S.LB field 2410 each include page-aligned linearaddresses that establish the upper bound and lower bound, respectively,that may be used by the shadow stack. Those bounds may prevent theshadow stack from growing too large and interfering with other memoryregions. The SHADOW_STK_U/S.UB field 2408 also includes an enable bit.The enable bit determines whether shadow stack checking may be enabledby the processor 120. The processor 120 may also only enable shadowstack checking if the bounds register enable (e.g., CR4.SLRR_EN) bit isset, if the CR4.SHADOW_STK_EN flag 2402 is enabled, and if the sandboxflag (e.g., SANDBOX_CTL_U.SANDBOX) is also enabled. As shown, theprocessor 120 also establishes a SHADOW_STK_MISM_IP_U/S register 2412,which may include the 64-bit linear address of the stack mismatchviolation exception handler in the unsandbox 214. As shown, duringdispatch of the exception, the legacy return address is stored in theSANDBOX_DISP_ADDR register 1812 and the shadow return address is storedin the SANDBOX_DISP_QUAL register 1814.

The SLRR and shadow stack support may also provide shadow stackprotections for legacy operating systems. In particular, if it is notpossible to modify OS components that legitimately switch stacks, thenit may be helpful to be able to monitor accesses to the legacy stack anddetect switches between distinct legacy stacks. This may be accomplishedusing SLRRs by defining narrow bounds on the accesses through SS (thelegacy stack segment) in the associated SLRR. This also may make itpreferable to avoid incorporating SLRR checks into TLB fills but insteadchecking them for every access, since this stack window moves frequentlyand may thus result in stale TLB entries needing to be flushed.

Referring now to FIG. 25 , in use, the computing device 100 may executea method 2500 for handling a system call instruction. It should beappreciated that, in some embodiments, the operations of the method 2500may be performed by one or more components of the environment 200 of thecomputing device 100 as shown in FIG. 2 . The method 2500 begins inblock 2502, in which the sandboxed application 216 of the computingdevice 100 executes a system call instruction in the sandbox mode. Thesystem call instruction may be embodied as any processor instructionthat may cause the processor 120 to switch to a higher privilege level.For example, the sandboxed application 216 may execute a SYSCALL,SYSENTER, or other similar instruction.

In block 2504, the processor 120 of the computing device 100 dispatchesa system call exception to a system call handler in the unsandbox 214.The processor 120 dispatches the exception using the sandbox exceptiondispatch method described above in connection with FIGS. 17-18 . Theprocessor 120 does not include any custom data in the dispatch addressor dispatch qualification registers. In block 2506, the processor 120jumps to system call handler in the unsandbox 214 that is identified ina configuration register of the processor 120.

In block 2508, the system call handler of the unsandbox 214 processesthe system call exception. For example, the unsandbox 214 may determinethe requested system call and perform the system call operation that thesandboxed application 216 expects to be performed by an operating systemor virtual machine monitor (VMM). In some embodiments, in block 2510, auser-mode VMM of the computing device 100 may invoke a system callhandler of a paravirtualized user-mode kernel of the computing device100. The paravirtualized user-mode kernel may service the system call.For example, in some embodiments the unsandbox 214 may include theuser-mode VMM, and the sandboxed application 216 may include theparavirtualized user-mode kernel (and the associated processes managedby that kernel). In those embodiments, the user-mode VMM may effectivelyvirtualize system calls generated from within the sandbox withoutrequiring the processor 120 to exit the user mode. In some embodiments,the user-mode VMM, paravirtualized user-mode kernel, and associatedprocesses may all be included in an Intel® SGX secure enclave. In thoseembodiments, system calls may be virtualized without requiring theprocessor 120 to exit the secure enclave. Additionally, by virtualizingsystem call instructions, processes may be executed in the sandboxtransparently, without requiring modifications to the applicationbinaries. After processing the system call exception, the unsandbox 214returns execution to the sandboxed application 216 as described above.The method 2500 loops back to block 2502, in which the sandboxedapplication 216 may execute additional system call instructions.Accordingly, using the computing device 100 to support a paravirtualizedcontainer host may provide low-latency process switches as well as theability to run the entire virtualized host inside a single SGX enclave.Placing an entire virtualized host in a secure enclave may be useful tominimize expensive enclave boundary crossings, to provide self-containedattestation of the proper sandboxing within the enclave, and to hardenthe internal communications between sandboxes by keeping them within theboundaries of the enclave.

It should be appreciated that, in some embodiments, the methods 300,500, 700, 900, 1000, 1300, 1400, 1500, 1700, 1900, 2100, 2300, and/or2500 may be embodied as various instructions stored on acomputer-readable media, which may be executed by the processor 120, theI/O subsystem 126, and/or other components of the computing device 100to cause the computing device 100 to perform the respective method 300,500, 700, 900, 1000, 1300, 1400, 1500, 1700, 1900, 2100, 2300, and/or2500. The computer-readable media may be embodied as any type of mediacapable of being read by the computing device 100 including, but notlimited to, the memory 128, the data storage device 130, firmwaredevices, and/or other media.

EXAMPLES

Illustrative examples of the technologies disclosed herein are providedbelow. An embodiment of the technologies may include any one or more,and any combination of, the examples described below.

Example 1 includes a computing device for process isolation, thecomputing device comprising: a processor, wherein the processorcomprises a segmentation manager to: (i) load a logical address, whereinthe logical address includes a segment selector and an effectiveaddress, and wherein the segment selector is indicative of a segmentbase and an effective limit, and (ii) generate a linear address as afunction of the logical address with the effective limit as a mask,wherein generating the linear address comprises, for each bit of thelogical address, selecting a corresponding bit from the segment base orfrom the effective address based on a value of a corresponding bit fromthe effective limit.

Example 2 includes the subject matter of Example 1, and wherein to loadthe logical address comprises to: read a segment selector from a segmentselector register of the processor; index a segment descriptor table ina memory of the computing device with the segment selector to read asegment descriptor; and load the segment base and the effective limitfrom the segment descriptor.

Example 3 includes the subject matter of any of Examples 1 and 2, andwherein the segment base, the effective limit, the effective address,and the linear address each comprise a 32-bit value.

Example 4 includes the subject matter of any of Examples 1-3, andwherein the segment base, the effective limit, the effective address,and the linear address each comprise a 64-bit value.

Example 5 includes the subject matter of any of Examples 1-4, andwherein to select the corresponding bit from the segment base or fromthe effective address comprises to select the corresponding bit with amultiplexer device of the processor.

Example 6 includes the subject matter of any of Examples 1-5, andwherein: the processor further comprises a task manager to (i) switch toa new task, wherein the new task is described by a task state segmentextension in a memory of the computing device, and activate alow-latency segmentation mode in response to a switch to the new task,wherein the task state segment extension is indicative of thelow-latency segmentation mode; wherein to load the logical addresscomprises to load the logical address in response to activation of thelow-latency segmentation mode.

Example 7 includes the subject matter of any of Examples 1-6, andwherein to switch to the new task comprises to: store a current stackpointer value of the processor to a second task state segment extensionassociated with a previous task; load an enhanced segmentation taskregister with a pointer value indicative of the task state segmentextension; and load a segmentation state of the processor for the newtask from the task state segment extension.

Example 8 includes the subject matter of any of Examples 1-7, andwherein to load the segmentation state of the processor comprises to:load a local descriptor table register of the processor with a localdescriptor table pointer from the task state segment extension; load astack segment register of the processor with a stack segment selectorfrom the task state segment extension; load a code segment register ofthe processor with a code segment selector from the task state segmentextension; load a stack pointer register of the processor with a stackpointer value from the task state segment extension; and load aninstruction pointer register of the processor with an instructionpointer value from the task state segment extension.

Example 9 includes the subject matter of any of Examples 1-8, andwherein the processor further comprises a sandbox manager to: determinewhether an application sandbox mode is enabled; determine whether adestination segment for the new task is identified in a local descriptortable in response to a determination that the application sandbox modeis enabled; determine whether a descriptor privilege level of thedestination segment is less than a current privilege level of theprocessor in response to a determination that the destination segmentfor the new task is identified in the local descriptor table; andgenerate an exception in response to a determination that the descriptorprivilege level is less than the current privilege level.

Example 10 includes the subject matter of any of Examples 1-9, andfurther comprising a software isolation manager to: load an unsandbox ina user privilege level; load, by the unsandbox, a sandboxed applicationin the user privilege level; configure, by the unsandbox, the task statesegment extension, wherein the new task described by the task statesegment extension comprises the sandboxed application; enable, by theunsandbox, the application sandbox mode; and execute the sandboxedapplication in response to enablement of the application sandbox mode;wherein to load the logical address comprises to load the logicaladdress in response to execution of the sandboxed application.

Example 11 includes the subject matter of any of Examples 1-10, andwherein: the software isolation manager is further to load a host kernelin a supervisor privilege level; and the host kernel is to load a hostapplication in the user privilege level, wherein the host applicationcomprises the unsandbox.

Example 12 includes the subject matter of any of Examples 1-11, andwherein: the processor further comprises secure enclave support; thesoftware isolation manager is further to load a secure enclave in thehost application using the secure enclave support of the processor; toload the unsandbox comprises to load the unsandbox in the secureenclave; and to load the sandboxed application comprises to load thesandboxed application in the secure enclave.

Example 13 includes the subject matter of any of Examples 1-12, andwherein the software isolation manager is further to attest to thesecure enclave, wherein to attest to the secure enclave comprises tomeasure a global descriptor table of the sandboxed application, a localdescriptor table of the sandboxed application, and the task statesegment extension.

Example 14 includes the subject matter of any of Examples 1-13, andwherein the software isolation manager is further to: load, by the hostapplication, a user-level virtual machine monitor, wherein theuser-level virtual machine monitor comprises the unsandbox; and load, bythe host application, a paravirtualized kernel, wherein theparavirtualized kernel manages the sandboxed application; wherein toconfigure the task state segment extension comprises to configure thetask state segment extension by the user-level virtual machine monitor.

Example 15 includes the subject matter of any of Examples 1-14, andwherein: the software isolation manager is further to handle, by theuser-level virtual machine monitor, a virtualized system call from thesandboxed application in the user privilege level; and to execute thesandboxed application further comprises to virtualize the system call,and wherein to virtualize the system call comprises to replicate amodel-specific register of the processor that regulates user tosupervisor mode transitions.

Example 16 includes the subject matter of any of Examples 1-15, andwherein the software isolation manager is further to: set a segmentationmode associated with the host kernel to a permissive segmentation mode;and set, by the host application, a segmentation mode associated withthe task state segment extension to the low-latency segmentation mode.

Example 17 includes the subject matter of any of Examples 1-16, andwherein the software isolation manager is further to set a segment baseand an effective limit associated with the unsandbox to zero in responseto setting of the segmentation mode to the permissive segmentation mode.

Example 18 includes the subject matter of any of Examples 1-17, andwherein the software isolation manager is further to: load, by thesandboxed application, a nested sandboxed application in the userprivilege level; configure, by the sandboxed application, a second taskstate segment extension that describes a second task, wherein the secondtask comprises the nested sandboxed application; and execute, by thecomputing device, the nested sandboxed application in response toconfiguration of the second task state segment extension.

Example 19 includes the subject matter of any of Examples 1-18, andwherein the processor further comprises a protection domain manager to:switch to a new protection domain, wherein the protection domaincomprises a unit of code and data that may be used by multiple softwarethreads; load a segmentation state of the processor for the newprotection domain from a domain object segment, wherein the segmentationstate comprises a local descriptor table selector and a code segmentselector; load an entry point instruction pointer for the new protectiondomain from the domain object segment; determine if a subsystemidentifier of the domain object segment is different from a currentsubsystem identifier of a current protection domain; index a subsystemtable in a memory of the computing device with the subsystem identifierto retrieve a subsystem table entry in response to a determination thatthe subsystem identifier of the domain object segment is different fromthe current subsystem identifier; load a stack segmentation state fromthe subsystem table entry in response to indexing of the subsystemtable, wherein the stack segmentation state comprises a stack segmentselector and a stack pointer; and activate a low-latency segmentationmode in response to the indexing of the subsystem table, wherein thesubsystem table entry is indicative of the low-latency segmentationmode; wherein to load the logical address comprises to load the logicaladdress in response to activation of the low-latency segmentation mode.

Example 20 includes the subject matter of any of Examples 1-19, andwherein the protection domain manager is further to store a currentstack pointer of the processor in the subsystem table in response to adetermination that the subsystem identifier of the domain object segmentis different from the current subsystem identifier; wherein to load thestack segmentation state further comprises to load the stacksegmentation state in response to storage of the current stack pointer.

Example 21 includes the subject matter of any of Examples 1-20, andwherein the protection domain manager is further to store a stack limitin the subsystem table in response to the determination that thesubsystem identifier of the domain object segment is different from thecurrent subsystem identifier.

Example 22 includes the subject matter of any of Examples 1-21, andwherein the processor further comprises a call segment manager to:execute a call operation, wherein the call operation is indicative of atarget code destination; push a call gate on a control stack in responseto execution of the call operation, wherein the call gate is indicativeof a return point associated with the call operation, and wherein thecontrol stack is included in a control stack segment of the memory ofthe computing device; execute a return operation in response toexecution of the call operation; determine whether a return address of alegacy stack matches an address of a top call gate of the control stackin response to execution of the return operation; and generate a controlstack mismatch exception in response to a determination that the returnaddress of the legacy stack does not match the address of the top callgate of the control stack.

Example 23 includes the subject matter of any of Examples 1-22, andwherein: to execute the call operation comprises to execute a calloperation to the new protection domain; and to execute the returnoperation comprises to execute a return operation to the currentprotection domain.

Example 24 includes the subject matter of any of Examples 1-23, andwherein the control stack manager is further to: read a control stacksegment mode from the subsystem table entry in response to the indexingof the subsystem table; and determine whether the control stack segmentmode comprises an intra-domain transfer mode; wherein: to execute thecall operation comprises to execute a call operation to the newprotection domain; to execute the return operation comprises to executea return operation to the new protection domain; to push the call gatefurther comprises to push the call gate in response to a determinationthat the control stack segment mode comprises the intra-domain transfermode; and to determine whether the return address of the legacy stackmatches the address of the top call gate further comprises to determinewhether the return address of the legacy stack matches the address ofthe top call gate in response to the determination that the controlstack segment mode comprises the intra-domain transfer mode.

Example 25 includes the subject matter of any of Examples 1-24, andfurther comprising: a software isolation manager to (i) load anunsandbox in a user privilege level of the processor, (ii) load, by theunsandbox, a sandboxed application in the user privilege level, (iii)store, by the unsandbox, an extended descriptor selector in a codesegment register of the processor, wherein the extended descriptorselector references an extended descriptor of an extended descriptortable, and (iv) execute the sandboxed application in response toenablement of an application sandbox mode of the processor; wherein theprocessor further comprises a sandbox manager to enable the applicationsandbox mode in response to storage of the extended descriptor selectorin the code segment register; and wherein to load the logical addresscomprises to load the logical address in response to execution of thesandboxed application.

Example 26 includes the subject matter of any of Examples 1-25, andwherein the extended descriptor selector comprises a 32-bit valueincluding a 15-bit protection domain identifier, an extended descriptorbit, and an extended descriptor offset.

Example 27 includes the subject matter of any of Examples 1-26, andwherein the extended descriptor table comprises a hierarchical tablehaving a first level and a second level, wherein the first level isindexed by the protection domain identifier of the extended descriptorselector and wherein the second level is indexed by the extendeddescriptor offset of the extended descriptor selector.

Example 28 includes the subject matter of any of Examples 1-27, andwherein the sandbox manager is further to prohibit, by the processor,loading of a segment register of the processor with a legacy descriptorselector in response to the enablement of the application sandbox mode,wherein the legacy descriptor selector references a legacy descriptor ofa local descriptor table or a global descriptor table.

Example 29 includes a computing device for process isolation, thecomputing device comprising: a software isolation manager to: (i)execute an unsandbox in a first privilege level of a processor of thecomputing device, (ii) enable, by the unsandbox, a sandbox mode of theprocessor, wherein to enable the sandbox mode comprises to set a sandboxflag of the processor, and (iii) execute a sandboxed application in thesandbox mode and in the first privilege level in response to enablementof the sandbox mode; wherein the processor comprises a sandbox managerto (i) generate a sandbox exception in response to execution of thesandboxed application and (ii) dispatch the sandbox exception to asandbox exception handler of the unsandbox in response to generation ofthe sandbox exception; wherein the software isolation manager is furtherto execute, by the unsandbox in the first privilege level, a dispatchreturn instruction in response to a dispatch of the sandbox exception;and wherein sandbox manager of the processor is further to resumeexecution of the sandboxed application in the sandbox mode and in thefirst privilege level in response to execution of the dispatch returninstruction.

Example 30 includes the subject matter of Example 29, and wherein thefirst privilege level comprises a user privilege level of the processor.

Example 31 includes the subject matter of any of Examples 29 and 30, andwherein the first privilege level comprises a supervisor privilege levelof the processor.

Example 32 includes the subject matter of any of Examples 29-31, andwherein: the software isolation manager is further to execute, by theunsandbox, the dispatch handler in the first privilege level in responseto the dispatch of the sandbox exception; wherein to execute thedispatch return instruction comprises to execute the dispatch returninstruction in response to execution of the dispatch handler.

Example 33 includes the subject matter of any of Examples 29-32, andwherein to dispatch the sandbox exception to the sandbox exceptionhandler of the unsandbox comprises to: store one or more sandboxdispatch values into corresponding registers of the processor inresponse to the generation of the sandbox exception, wherein the sandboxdispatch values include a return address within the sandboxedapplication; clear the sandbox flag of the processor in response to thegeneration of the sandbox exception; and jump to the sandbox exceptionhandler within the unsandbox in response to clearing of the sandboxflag, wherein the sandbox exception handler is identified by a dispatchinstruction pointer register of the processor.

Example 34 includes the subject matter of any of Examples 29-33, andwherein the one or more sandbox dispatch values further include a returnaddress within the sandboxed application, a dispatch address associatedwith the sandbox exception, and dispatch qualification data associatedwith the sandbox exception.

Example 35 includes the subject matter of any of Examples 29-34, andwherein to resume execution of the sandboxed application comprises toset the sandbox flag of the processor.

Example 36 includes the subject matter of any of Examples 29-35, andwherein to set the sandbox flag comprises to set a sandbox flag bit of asandbox enable control register of the processor.

Example 37 includes the subject matter of any of Examples 29-36, andwherein: the software isolation manager is further to configure, by theunsandbox, a range register linked to a first segment register of theprocessor, wherein to enable the sandbox mode comprises to enable thesandbox mode in response to configuration of the range register; toexecute the sandboxed application comprises to map, by the processor, alogical address to a linear address, wherein the logical addresscomprises a segment selector and an effective address, wherein thesegment selector is indicative of a segment base and an effective limit,and wherein the segment selector is associated with the first segmentregister; to generate the sandbox exception comprises to determinewhether the linear address is within memory bounds defined by the rangeregister; and to dispatch the sandbox exception comprises to dispatch asegment range sandbox violation in response to a determination that thelinear address is not within the memory bounds defined by the rangeregister.

Example 38 includes the subject matter of any of Examples 29-37, andwherein to configure the range register comprises to store an upperbound linear address and a lower bound linear address in the rangeregister.

Example 39 includes the subject matter of any of Examples 29-38, andwherein to dispatch the sandbox exception further comprises to (i) storethe linear address in a dispatch address register of the processor and(ii) store a segment identifier indicative of the first segment registerin a dispatch qualification data register of the processor.

Example 40 includes the subject matter of any of Examples 29-39, andwherein the software isolation manager is further to execute, by theunsandbox, the dispatch handler in the first privilege level in responseto the dispatch of the sandbox exception, wherein to execute thedispatch handler comprises to: execute, by the unsandbox, an XSAVEinstruction to save a sandbox configuration of a current thread; enable,by the unsandbox, a sandbox flag in a second sandbox configuration thatcorresponds to a destination thread, wherein the second sandboxconfiguration is stored in an XSAVE memory area; execute, by theunsandbox, an XRSTOR instruction to restore the second sandboxconfiguration in response to enablement of the sandbox flag in thesecond sandbox configuration; and switch to the destination thread inresponse to execution of the XRSTOR instruction.

Example 41 includes the subject matter of any of Examples 29-40, andwherein: to execute the sandboxed application comprises to execute, bythe sandboxed application, a near return instruction; to generate thesandbox exception comprises to determine whether a top return address ofa shadow stack matches a top return address of a legacy stack inresponse to execution of the near return instruction; and to dispatchthe sandbox exception comprises to dispatch a stack mismatch violationin response to a determination that the top return address of the shadowstack does not match the top return address of a legacy stack.

Example 42 includes the subject matter of any of Examples 29-41, andwherein to dispatch the sandbox exception further comprises to store thetop return address of the legacy stack in a dispatch address register ofthe processor and to store the top return address of the shadow stack ina dispatch qualification data register of the processor.

Example 43 includes the subject matter of any of Examples 29-42, andwherein the processor comprises a plurality of segment registers and aplurality of range registers, wherein each range register is linked to acorresponding segment register, and wherein the shadow stack is outsideof each of a plurality of memory bounds, wherein each memory bound isestablished by a corresponding range register.

Example 44 includes the subject matter of any of Examples 29-43, andwherein: to generate the sandbox exception further comprises todetermine, by the processor, whether a global sandbox enable flag of aconfiguration register of the processor is set in response to executingthe near return instruction; and to dispatch the sandbox exceptionfurther comprises to dispatch the stack mismatch violation in responseto the determination that the top return address of the shadow stackdoes not match the top return address of the legacy stack and adetermination that the global sandbox enable flag of the configurationregister is set.

Example 45 includes the subject matter of any of Examples 29-44, andwherein: to generate the sandbox exception comprises to execute, by thesandboxed application, a system call instruction; and to dispatch thesandbox exception comprises to dispatch, by the processor, a system callexception to the unsandbox in the first privilege level in response toexecution of the system call instruction.

Example 46 includes the subject matter of any of Examples 29-45, andwherein the software isolation manager is further to: load a host kernelin a supervisor privilege level of the processor; and load, by the hostkernel, a host application in the first privilege level, wherein thehost application comprises the unsandbox, and wherein the firstprivilege level comprises a user privilege level of the processor.

Example 47 includes the subject matter of any of Examples 29-46, andwherein the software isolation manager is further to: load a secureenclave in the host application using secure enclave support of theprocessor; wherein to execute the unsandbox in the first privilege levelcomprises to execute the unsandbox within the secure enclave; andwherein to execute the sandboxed application in the sandbox mode and inthe user privilege comprises to execute the sandboxed application withinthe secure enclave.

Example 48 includes the subject matter of any of Examples 29-47, andwherein the software isolation manager is further to: load, by the hostapplication of the computing device, a user-level virtual machinemonitor, wherein the user-level virtual machine monitor comprises theunsandbox; and load, by the user-level virtual machine monitor, auser-level paravirtualized kernel, wherein the user-levelparavirtualized kernel comprises the sandboxed application.

Example 49 includes a method for process isolation, the methodcomprising: loading, by a processor of a computing device, a logicaladdress, wherein the logical address includes a segment selector and aneffective address, and wherein the segment selector is indicative of asegment base and an effective limit; and generating, by the processor, alinear address as a function of the logical address with the effectivelimit as a mask, wherein generating the linear address comprises, foreach bit of the logical address, selecting a corresponding bit from thesegment base or from the effective address based on a value of acorresponding bit from the effective limit.

Example 50 includes the subject matter of Example 49, and whereinloading the logical address comprises: reading a segment selector from asegment selector register of the processor; indexing a segmentdescriptor table in a memory of the computing device with the segmentselector to read a segment descriptor; and loading the segment base andthe effective limit from the segment descriptor.

Example 51 includes the subject matter of any of Examples 49 and 50, andwherein the segment base, the effective limit, the effective address,and the linear address each comprise a 32-bit value.

Example 52 includes the subject matter of any of Examples 49-51, andwherein the segment base, the effective limit, the effective address,and the linear address each comprise a 64-bit value.

Example 53 includes the subject matter of any of Examples 49-52, andwherein selecting the corresponding bit from the segment base or fromthe effective address comprises selecting the corresponding bit with amultiplexer device of the processor.

Example 54 includes the subject matter of any of Examples 49-53, andfurther comprising: switching, by the processor, to a new task, whereinthe new task is described by a task state segment extension in a memoryof the computing device; and activating, by the processor, a low-latencysegmentation mode in response to switching to the new task, wherein thetask state segment extension is indicative of the low-latencysegmentation mode; wherein loading the logical address comprises loadingthe logical address in response to activating the low-latencysegmentation mode.

Example 55 includes the subject matter of any of Examples 49-54, andwherein switching to the new task comprises: storing a current stackpointer value of the processor to a second task state segment extensionassociated with a previous task; loading an enhanced segmentation taskregister with a pointer value indicative of the task state segmentextension; and loading a segmentation state of the processor for the newtask from the task state segment extension.

Example 56 includes the subject matter of any of Examples 49-55, andwherein loading the segmentation state of the processor comprises:loading a local descriptor table register of the processor with a localdescriptor table pointer from the task state segment; extension loadinga stack segment register of the processor with a stack segment selectorfrom the task state segment extension; loading a code segment registerof the processor with a code segment selector from the task statesegment extension; loading a stack pointer register of the processorwith a stack pointer value from the task state segment extension; andloading an instruction pointer register of the processor with aninstruction pointer value from the task state segment extension.

Example 57 includes the subject matter of any of Examples 49-56, andfurther comprising: determining, by the processor, whether anapplication sandbox mode is enabled; determining, by the processor,whether a destination segment for the new task is identified in a localdescriptor table in response to determining that the application sandboxmode is enabled; determining, by the processor, whether a descriptorprivilege level of the destination segment is less than a currentprivilege level of the processor in response to determining that thedestination segment for the new task is identified in the localdescriptor table; and generating, by the processor, an exception inresponse to determining that the descriptor privilege level is less thanthe current privilege level.

Example 58 includes the subject matter of any of Examples 49-57, andfurther comprising: loading, by the computing device, an unsandbox in auser privilege level; loading, by the unsandbox of the computing device,a sandboxed application in the user privilege level; configuring, by theunsandbox of the computing device, the task state segment extension,wherein the new task described by the task state segment extensioncomprises the sandboxed application; enabling, by the unsandbox of thecomputing device, the application sandbox mode; and executing, by thecomputing device, the sandboxed application in response to enabling theapplication sandbox mode; wherein loading the logical address comprisesloading the logical address in response to executing the sandboxedapplication.

Example 59 includes the subject matter of any of Examples 49-58, andfurther comprising: loading, by the computing device, a host kernel in asupervisor privilege level; and loading, by the host kernel, a hostapplication in the user privilege level, wherein the host applicationcomprises the unsandbox.

Example 60 includes the subject matter of any of Examples 49-59, andfurther comprising: loading, by the computing device, a secure enclavein the host application using secure enclave support of the processor;wherein loading the sandboxed application comprises loading thesandboxed application in the secure enclave.

Example 61 includes the subject matter of any of Examples 49-60, andfurther comprising attesting, by the computing device, to the secureenclave, wherein attesting to the secure enclave comprises measuring aglobal descriptor table of the sandboxed application, a local descriptortable of the sandboxed application, and the task state segmentextension.

Example 62 includes the subject matter of any of Examples 49-61, andfurther comprising: loading, by the host application of the computingdevice, a user-level virtual machine monitor, wherein the user-levelvirtual machine monitor comprises the unsandbox; and loading, by thehost application of the computing device, a paravirtualized kernel,wherein the paravirtualized kernel manages the sandboxed application;wherein configuring the task state segment extension comprisesconfiguring the task state segment extension by the user-level virtualmachine monitor.

Example 63 includes the subject matter of any of Examples 49-62, andfurther comprising: handling, by the user-level virtual machine monitorof the computing device, a virtualized system call from the sandboxedapplication in the user privilege level; wherein executing the sandboxedapplication further comprises virtualizing the system call, and whereinvirtualizing the system call comprises replicating a model-specificregister of the processor that regulates user to supervisor modetransitions.

Example 64 includes the subject matter of any of Examples 49-63, andfurther comprising: setting, by the computing device, a segmentationmode associated with the host kernel to a permissive segmentation mode;and setting, by the host application of the computing device, asegmentation mode associated with the task state segment extension tothe low-latency segmentation mode.

Example 65 includes the subject matter of any of Examples 49-64, andfurther comprising setting, by the computing device, a segment base andan effective limit associated with the unsandbox to zero in response tosetting the segmentation mode to the permissive segmentation mode.

Example 66 includes the subject matter of any of Examples 49-65, andfurther comprising: loading, by the sandboxed application of thecomputing device, a nested sandboxed application in the user privilegelevel; configuring, by the sandboxed application of the computingdevice, a second task state segment extension that describes a secondtask, wherein the second task comprises the nested sandboxedapplication; and executing, by the computing device, the nestedsandboxed application in response to configuring the second task statesegment extension.

Example 67 includes the subject matter of any of Examples 49-66, andfurther comprising: switching, by the processor, to a new protectiondomain, wherein the protection domain comprises a unit of code and datathat may be used by multiple software threads; loading, by theprocessor, a segmentation state of the processor for the new protectiondomain from a domain object segment, wherein the segmentation statecomprises a local descriptor table selector and a code segment selector;loading, by the processor, an entry point instruction pointer for thenew protection domain from the domain object segment; determining, bythe processor, if a subsystem identifier of the domain object segment isdifferent from a current subsystem identifier of a current protectiondomain; indexing, by the processor, a subsystem table in a memory of thecomputing device with the subsystem identifier to retrieve a subsystemtable entry in response to determining that the subsystem identifier ofthe domain object segment is different from the current subsystemidentifier; loading, by the processor, a stack segmentation state fromthe subsystem table entry in response to indexing the subsystem table,wherein the stack segmentation state comprises a stack segment selectorand a stack pointer; and activating, by the processor, a low-latencysegmentation mode in response to indexing the subsystem table, whereinthe subsystem table entry is indicative of the low-latency segmentationmode; wherein loading the logical address comprises loading the logicaladdress in response to activating the low-latency segmentation mode.

Example 68 includes the subject matter of any of Examples 49-67, andfurther comprising storing, by the processor, a current stack pointer ofthe processor in the subsystem table in response to determining that thesubsystem identifier of the domain object segment is different from thecurrent subsystem identifier; wherein loading the stack segmentationstate further comprises loading the stack segmentation state in responseto storing the current stack pointer.

Example 69 includes the subject matter of any of Examples 49-68, andfurther comprising storing, by the computing device, a stack limit inthe subsystem table in response to determining that the subsystemidentifier of the domain object segment is different from the currentsubsystem identifier.

Example 70 includes the subject matter of any of Examples 49-69, andfurther comprising: executing, by the processor, a call operation,wherein the call operation is indicative of a target code destination;pushing, by the processor, a call gate on a control stack in response toexecuting the call operation, wherein the call gate is indicative of areturn point associated with the call operation, and wherein the controlstack is included in a control stack segment of the memory of thecomputing device; executing, by the processor, a return operation inresponse to executing the call operation; determining, by the processor,whether a return address of a legacy stack matches an address of a topcall gate of the control stack in response to executing the returnoperation; and generating, by the processor, a control stack mismatchexception in response to determining that the return address of thelegacy stack does not match the address of the top call gate of thecontrol stack.

Example 71 includes the subject matter of any of Examples 49-70, andwherein: executing the call operation comprises executing a calloperation to the new protection domain; and executing the returnoperation comprises executing a return operation to the currentprotection domain.

Example 72 includes the subject matter of any of Examples 49-71, andfurther comprising: reading, by the processor, a control stack segmentmode from the subsystem table entry in response to indexing thesubsystem table; and determining, by the processor, whether the controlstack segment mode comprises an intra-domain transfer mode; wherein:executing the call operation comprises executing a call operation to thenew protection domain; executing the return operation comprisesexecuting a return operation to the new protection domain; pushing thecall gate further comprises pushing the call gate in response todetermining that the control stack segment mode comprises theintra-domain transfer mode; and determining whether the return addressof the legacy stack matches the address of the top call gate furthercomprises determining whether the return address of the legacy stackmatches the address of the top call gate in response to determining thatthe control stack segment mode comprises the intra-domain transfer mode.

Example 73 includes the subject matter of any of Examples 49-72, andfurther comprising: loading, by the computing device, an unsandbox in auser privilege level of the processor; loading, by the unsandbox of thecomputing device, a sandboxed application in the user privilege level;storing, by the unsandbox of the computing device, an extendeddescriptor selector in a code segment register of the processor, whereinthe extended descriptor selector references an extended descriptor of anextended descriptor table; enabling, by the computing device, anapplication sandbox mode in response to storing the extended descriptorselector in the code segment register; and executing, by the computingdevice, the sandboxed application in response to enabling theapplication sandbox mode; wherein loading the logical address comprisesloading the logical address in response to executing the sandboxedapplication.

Example 74 includes the subject matter of any of Examples 49-73, andwherein the extended descriptor selector comprises a 32-bit valueincluding a 15-bit protection domain identifier, an extended descriptorbit, and an extended descriptor offset.

Example 75 includes the subject matter of any of Examples 49-74, andwherein the extended descriptor table comprises a hierarchical tablehaving a first level and a second level, wherein the first level isindexed by the protection domain identifier of the extended descriptorselector and wherein the second level is indexed by the extendeddescriptor offset of the extended descriptor selector.

Example 76 includes the subject matter of any of Examples 49-75, andfurther comprising prohibiting, by the processor, loading of a segmentregister of the processor with a legacy descriptor selector in responseto enabling the application sandbox mode, wherein the legacy descriptorselector references a legacy descriptor of a local descriptor table or aglobal descriptor table.

Example 77 includes a method for process isolation, the methodcomprising: executing, by a computing device, an unsandbox in a firstprivilege level of a processor of the computing device; enabling, by theunsandbox of the computing device, a sandbox mode of the processor,wherein enabling the sandbox mode comprises setting a sandbox flag ofthe processor; executing, by the computing device, a sandboxedapplication in the sandbox mode and in the first privilege level inresponse to enabling the sandbox mode; generating, by the processor, asandbox exception in response to executing the sandboxed application;dispatching, by the processor, the sandbox exception to a sandboxexception handler of the unsandbox in response to generating the sandboxexception; executing, by the unsandbox in the first privilege level, adispatch return instruction in response to dispatching the sandboxexception; and resuming, by the processor, execution of the sandboxedapplication in the sandbox mode and in the first privilege level inresponse to executing the dispatch return instruction.

Example 78 includes the subject matter of Example 77, and wherein thefirst privilege level comprises a user privilege level of the processor.

Example 79 includes the subject matter of any of Examples 77 and 78, andwherein the first privilege level comprises a supervisor privilege levelof the processor.

Example 80 includes the subject matter of any of Examples 77-79, andfurther comprising: executing, by the unsandbox, the dispatch handler inthe first privilege level in response to dispatching the sandboxexception; wherein executing the dispatch return instruction comprisesexecuting the dispatch return instruction in response to executing thedispatch handler.

Example 81 includes the subject matter of any of Examples 77-80, andwherein dispatching the sandbox exception to the sandbox exceptionhandler of the unsandbox comprises: storing, by the processor, one ormore sandbox dispatch values into corresponding registers of theprocessor in response to generating the sandbox exception, wherein thesandbox dispatch values include a return address within the sandboxedapplication; clearing, by the processor, the sandbox flag of theprocessor in response to generating the sandbox exception; and jumping,by the processor, to the sandbox exception handler within the unsandboxin response to clearing the sandbox flag, wherein the sandbox exceptionhandler is identified by a dispatch instruction pointer register of theprocessor.

Example 82 includes the subject matter of any of Examples 77-81, andwherein the one or more sandbox dispatch values further include a returnaddress within the sandboxed application, a dispatch address associatedwith the sandbox exception, and dispatch qualification data associatedwith the sandbox exception.

Example 83 includes the subject matter of any of Examples 77-82, andwherein resuming execution of the sandboxed application comprisessetting, by the processor, the sandbox flag of the processor.

Example 84 includes the subject matter of any of Examples 77-83, andwherein setting the sandbox flag comprises setting a sandbox flag bit ofa sandbox enable control register of the processor.

Example 85 includes the subject matter of any of Examples 77-84, andfurther comprising: configuring, by the unsandbox, a range registerlinked to a first segment register of the processor, wherein enablingthe sandbox mode comprises enabling the sandbox mode in response toconfiguring the range register; wherein executing the sandboxedapplication comprises mapping, by the processor, a logical address to alinear address, wherein the logical address comprises a segment selectorand an effective address, wherein the segment selector is indicative ofa segment base and an effective limit, and wherein the segment selectoris associated with the first segment register; wherein generating thesandbox exception comprises determining, by the processor, whether thelinear address is within memory bounds defined by the range register;and wherein dispatching the sandbox exception comprises dispatching asegment range sandbox violation in response to determining that thelinear address is not within the memory bounds defined by the rangeregister.

Example 86 includes the subject matter of any of Examples 77-85, andwherein configuring the range register comprises storing an upper boundlinear address and a lower bound linear address in the range register.

Example 87 includes the subject matter of any of Examples 77-86, andwherein dispatching the sandbox exception further comprises storing thelinear address in a dispatch address register of the processor andstoring a segment identifier indicative of the first segment register ina dispatch qualification data register of the processor.

Example 88 includes the subject matter of any of Examples 77-87, andfurther comprising executing, by the unsandbox, the dispatch handler inthe first privilege level in response to dispatching the sandboxexception, wherein executing the dispatch handler comprises: executing,by the unsandbox, an XSAVE instruction to save a sandbox configurationof a current thread; enabling, by the unsandbox, a sandbox flag in asecond sandbox configuration that corresponds to a destination thread,wherein the second sandbox configuration is stored in an XSAVE memoryarea; executing, by the unsandbox, an XRSTOR instruction to restore thesecond sandbox configuration in response to enabling the sandbox flag inthe second sandbox configuration; and switching, by the computingdevice, to the destination thread in response to executing the XRSTORinstruction.

Example 89 includes the subject matter of any of Examples 77-88, andwherein: executing the sandboxed application comprises executing, by thesandboxed application, a near return instruction; generating the sandboxexception comprises determining, by the processor, whether a top returnaddress of a shadow stack matches a top return address of a legacy stackin response to executing the near return instruction; and dispatchingthe sandbox exception comprises dispatching, by the processor, a stackmismatch violation in response to determining that the top returnaddress of the shadow stack does not match the top return address of alegacy stack.

Example 90 includes the subject matter of any of Examples 77-89, andwherein dispatching the sandbox exception further comprises storing thetop return address of the legacy stack in a dispatch address register ofthe processor and storing the top return address of the shadow stack ina dispatch qualification data register of the processor.

Example 91 includes the subject matter of any of Examples 77-90, andwherein the processor comprises a plurality of segment registers and aplurality of range registers, wherein each range register is linked to acorresponding segment register, and wherein the shadow stack is outsideof each of a plurality of memory bounds, wherein each memory bound isestablished by a corresponding range register.

Example 92 includes the subject matter of any of Examples 77-91, andwherein: generating the sandbox exception further comprises determining,by the processor, whether a global sandbox enable flag of aconfiguration register of the processor is set in response to executingthe near return instruction; and dispatching the sandbox exceptionfurther comprises dispatching the stack mismatch violation in responseto determining that the top return address of the shadow stack does notmatch the top return address of a legacy stack and determining that theglobal sandbox enable flag of the configuration register is set.

Example 93 includes the subject matter of any of Examples 77-92, andwherein: generating the sandbox exception comprises executing, by thesandboxed application, a system call instruction; and dispatching thesandbox exception comprises dispatching, by the processor, a system callexception to the unsandbox in the first privilege level in response toexecuting the system call instruction.

Example 94 includes the subject matter of any of Examples 77-93, andfurther comprising: loading, by the computing device, a host kernel in asupervisor privilege level of the processor; and loading, by the hostkernel, a host application in the first privilege level, wherein thehost application comprises the unsandbox, and wherein the firstprivilege level comprises a user privilege level of the processor.

Example 95 includes the subject matter of any of Examples 77-94, andfurther comprising: loading, by the computing device, a secure enclavein the host application using secure enclave support of the processor;wherein executing the unsandbox in the first privilege level comprisesexecuting the unsandbox within the secure enclave; and wherein executingthe sandboxed application in the sandbox mode and in the user privilegecomprises executing the sandboxed application within the secure enclave.

Example 96 includes the subject matter of any of Examples 77-95, andfurther comprising: loading, by the host application of the computingdevice, a user-level virtual machine monitor, wherein the user-levelvirtual machine monitor comprises the unsandbox; and loading, by theuser-level virtual machine monitor, a user-level paravirtualized kernel,wherein the user-level paravirtualized kernel comprises the sandboxedapplication.

Example 97 includes a computing device comprising: a processor; and amemory having stored therein a plurality of instructions that whenexecuted by the processor cause the computing device to perform themethod of any of Examples 49-96.

Example 98 includes one or more machine readable storage mediacomprising a plurality of instructions stored thereon that in responseto being executed result in a computing device performing the method ofany of Examples 49-96.

Example 99 includes a computing device comprising means for performingthe method of any of Examples 49-96.

Example 100 includes a computing device for process isolation, thecomputing device comprising: means for loading, by a processor of thecomputing device, a logical address, wherein the logical addressincludes a segment selector and an effective address, and wherein thesegment selector is indicative of a segment base and an effective limit;and means for generating, by the processor, a linear address as afunction of the logical address with the effective limit as a mask,wherein generating the linear address comprises, for each bit of thelogical address, selecting a corresponding bit from the segment base orfrom the effective address based on a value of a corresponding bit fromthe effective limit.

Example 101 includes the subject matter of Example 100, and wherein themeans for loading the logical address comprises: means for reading asegment selector from a segment selector register of the processor;means for indexing a segment descriptor table in a memory of thecomputing device with the segment selector to read a segment descriptor;and means for loading the segment base and the effective limit from thesegment descriptor.

Example 102 includes the subject matter of any of Examples 100 and 101,and wherein the segment base, the effective limit, the effectiveaddress, and the linear address each comprise a 32-bit value.

Example 103 includes the subject matter of any of Examples 100-102, andwherein the segment base, the effective limit, the effective address,and the linear address each comprise a 64-bit value.

Example 104 includes the subject matter of any of Examples 100-103, andwherein the means for selecting the corresponding bit from the segmentbase or from the effective address comprises means for selecting thecorresponding bit with a multiplexer device of the processor.

Example 105 includes the subject matter of any of Examples 100-104, andfurther comprising: means for switching, by the processor, to a newtask, wherein the new task is described by a task state segmentextension in a memory of the computing device; and means for activating,by the processor, a low-latency segmentation mode in response toswitching to the new task, wherein the task state segment extension isindicative of the low-latency segmentation mode; wherein the means forloading the logical address comprises means for loading the logicaladdress in response to activating the low-latency segmentation mode.

Example 106 includes the subject matter of any of Examples 100-105, andwherein switching to the new task comprises: means for storing a currentstack pointer value of the processor to a second task state segmentextension associated with a previous task; means for loading an enhancedsegmentation task register with a pointer value indicative of the taskstate segment extension; and means for loading a segmentation state ofthe processor for the new task from the task state segment extension.

Example 107 includes the subject matter of any of Examples 100-106, andwherein the means for loading the segmentation state of the processorcomprises: means for loading a local descriptor table register of theprocessor with a local descriptor table pointer from the task statesegment; extension means for loading a stack segment register of theprocessor with a stack segment selector from the task state segmentextension; means for loading a code segment register of the processorwith a code segment selector from the task state segment extension;means for loading a stack pointer register of the processor with a stackpointer value from the task state segment extension; and means forloading an instruction pointer register of the processor with aninstruction pointer value from the task state segment extension.

Example 108 includes the subject matter of any of Examples 100-107, andfurther comprising: means for determining, by the processor, whether anapplication sandbox mode is enabled; means for determining, by theprocessor, whether a destination segment for the new task is identifiedin a local descriptor table in response to determining that theapplication sandbox mode is enabled; means for determining, by theprocessor, whether a descriptor privilege level of the destinationsegment is less than a current privilege level of the processor inresponse to determining that the destination segment for the new task isidentified in the local descriptor table; and means for generating, bythe processor, an exception in response to determining that thedescriptor privilege level is less than the current privilege level.

Example 109 includes the subject matter of any of Examples 100-108, andfurther comprising: means for loading an unsandbox in a user privilegelevel; means for loading, by the unsandbox of the computing device, asandboxed application in the user privilege level; means forconfiguring, by the unsandbox of the computing device, the task statesegment extension, wherein the new task described by the task statesegment extension comprises the sandboxed application; means forenabling, by the unsandbox of the computing device, the applicationsandbox mode; and means for executing the sandboxed application inresponse to enabling the application sandbox mode; wherein the means forloading the logical address comprises means for loading the logicaladdress in response to executing the sandboxed application.

Example 110 includes the subject matter of any of Examples 100-109, andfurther comprising: means for loading a host kernel in a supervisorprivilege level; and means for loading, by the host kernel, a hostapplication in the user privilege level, wherein the host applicationcomprises the unsandbox.

Example 111 includes the subject matter of any of Examples 100-110, andfurther comprising: means for loading a secure enclave in the hostapplication using secure enclave support of the processor; wherein themeans for loading the sandboxed application comprises means for loadingthe sandboxed application in the secure enclave.

Example 112 includes the subject matter of any of Examples 100-111, andfurther comprising means for attesting to the secure enclave, whereinthe means for attesting to the secure enclave comprises means formeasuring a global descriptor table of the sandboxed application, alocal descriptor table of the sandboxed application, and the task statesegment extension.

Example 113 includes the subject matter of any of Examples 100-112, andfurther comprising: means for loading, by the host application of thecomputing device, a user-level virtual machine monitor, wherein theuser-level virtual machine monitor comprises the unsandbox; and meansfor loading, by the host application of the computing device, aparavirtualized kernel, wherein the paravirtualized kernel manages thesandboxed application; wherein the means for configuring the task statesegment extension comprises means for configuring the task state segmentextension by the user-level virtual machine monitor.

Example 114 includes the subject matter of any of Examples 100-113, andfurther comprising: means for handling, by the user-level virtualmachine monitor of the computing device, a virtualized system call fromthe sandboxed application in the user privilege level; wherein the meansfor executing the sandboxed application further comprises means forvirtualizing the system call, and wherein the means for virtualizing thesystem call comprises means for replicating a model-specific register ofthe processor that regulates user to supervisor mode transitions.

Example 115 includes the subject matter of any of Examples 100-114, andfurther comprising: means for setting a segmentation mode associatedwith the host kernel to a permissive segmentation mode; and means forsetting, by the host application of the computing device, a segmentationmode associated with the task state segment extension to the low-latencysegmentation mode.

Example 116 includes the subject matter of any of Examples 100-115, andfurther comprising means for setting a segment base and an effectivelimit associated with the unsandbox to zero in response to setting thesegmentation mode to the permissive segmentation mode.

Example 117 includes the subject matter of any of Examples 100-116, andfurther comprising: means for loading, by the sandboxed application ofthe computing device, a nested sandboxed application in the userprivilege level; means for configuring, by the sandboxed application ofthe computing device, a second task state segment extension thatdescribes a second task, wherein the second task comprises the nestedsandboxed application; and means for executing the nested sandboxedapplication in response to configuring the second task state segmentextension.

Example 118 includes the subject matter of any of Examples 100-117, andfurther comprising: means for switching, by the processor, to a newprotection domain, wherein the protection domain comprises a unit ofcode and data that may be used by multiple software threads; means forloading, by the processor, a segmentation state of the processor for thenew protection domain from a domain object segment, wherein thesegmentation state comprises a local descriptor table selector and acode segment selector; means for loading, by the processor, an entrypoint instruction pointer for the new protection domain from the domainobject segment; means for determining, by the processor, if a subsystemidentifier of the domain object segment is different from a currentsubsystem identifier of a current protection domain; means for indexing,by the processor, a subsystem table in a memory of the computing devicewith the subsystem identifier to retrieve a subsystem table entry inresponse to determining that the subsystem identifier of the domainobject segment is different from the current subsystem identifier; meansfor loading, by the processor, a stack segmentation state from thesubsystem table entry in response to indexing the subsystem table,wherein the stack segmentation state comprises a stack segment selectorand a stack pointer; and means for activating, by the processor, alow-latency segmentation mode in response to indexing the subsystemtable, wherein the subsystem table entry is indicative of thelow-latency segmentation mode; wherein the means for loading the logicaladdress comprises means for loading the logical address in response toactivating the low-latency segmentation mode.

Example 119 includes the subject matter of any of Examples 100-118, andfurther comprising means for storing, by the processor, a current stackpointer of the processor in the subsystem table in response todetermining that the subsystem identifier of the domain object segmentis different from the current subsystem identifier; wherein the meansfor loading the stack segmentation state further comprises means forloading the stack segmentation state in response to storing the currentstack pointer.

Example 120 includes the subject matter of any of Examples 100-119, andfurther comprising means for storing a stack limit in the subsystemtable in response to determining that the subsystem identifier of thedomain object segment is different from the current subsystemidentifier.

Example 121 includes the subject matter of any of Examples 100-120, andfurther comprising: means for executing, by the processor, a calloperation, wherein the call operation is indicative of a target codedestination; means for pushing, by the processor, a call gate on acontrol stack in response to executing the call operation, wherein thecall gate is indicative of a return point associated with the calloperation, and wherein the control stack is included in a control stacksegment of the memory of the computing device; means for executing, bythe processor, a return operation in response to executing the calloperation; means for determining, by the processor, whether a returnaddress of a legacy stack matches an address of a top call gate of thecontrol stack in response to executing the return operation; and meansfor generating, by the processor, a control stack mismatch exception inresponse to determining that the return address of the legacy stack doesnot match the address of the top call gate of the control stack.

Example 122 includes the subject matter of any of Examples 100-121, andwherein: the means for executing the call operation comprises means forexecuting a call operation to the new protection domain; and the meansfor executing the return operation comprises means for executing areturn operation to the current protection domain.

Example 123 includes the subject matter of any of Examples 100-122, andfurther comprising: means for reading, by the processor, a control stacksegment mode from the subsystem table entry in response to indexing thesubsystem table; and means for determining, by the processor, whetherthe control stack segment mode comprises an intra-domain transfer mode;wherein: means for executing the call operation comprises executing acall operation to the new protection domain; means for executing thereturn operation comprises executing a return operation to the newprotection domain; means for pushing the call gate further comprisespushing the call gate in response to determining that the control stacksegment mode comprises the intra-domain transfer mode; and means fordetermining whether the return address of the legacy stack matches theaddress of the top call gate further comprises determining whether thereturn address of the legacy stack matches the address of the top callgate in response to determining that the control stack segment modecomprises the intra-domain transfer mode.

Example 124 includes the subject matter of any of Examples 100-123, andfurther comprising: means for loading an unsandbox in a user privilegelevel of the processor; means for loading, by the unsandbox of thecomputing device, a sandboxed application in the user privilege level;means for storing, by the unsandbox of the computing device, an extendeddescriptor selector in a code segment register of the processor, whereinthe extended descriptor selector references an extended descriptor of anextended descriptor table; means for enabling an application sandboxmode in response to storing the extended descriptor selector in the codesegment register; and means for executing the sandboxed application inresponse to enabling the application sandbox mode; wherein the means forloading the logical address comprises means for loading the logicaladdress in response to executing the sandboxed application.

Example 125 includes the subject matter of any of Examples 100-124, andwherein the extended descriptor selector comprises a 32-bit valueincluding a 15-bit protection domain identifier, an extended descriptorbit, and an extended descriptor offset.

Example 126 includes the subject matter of any of Examples 100-125, andwherein the extended descriptor table comprises a hierarchical tablehaving a first level and a second level, wherein the first level isindexed by the protection domain identifier of the extended descriptorselector and wherein the second level is indexed by the extendeddescriptor offset of the extended descriptor selector.

Example 127 includes the subject matter of any of Examples 100-126, andfurther comprising means for prohibiting, by the processor, loading of asegment register of the processor with a legacy descriptor selector inresponse to enabling the application sandbox mode, wherein the legacydescriptor selector references a legacy descriptor of a local descriptortable or a global descriptor table.

Example 128 includes a computing device for process isolation, thecomputing device comprising: means for executing an unsandbox in a firstprivilege level of a processor of the computing device; means forenabling, by the unsandbox of the computing device, a sandbox mode ofthe processor, wherein enabling the sandbox mode comprises setting asandbox flag of the processor; means for executing a sandboxedapplication in the sandbox mode and in the first privilege level inresponse to enabling the sandbox mode; means for generating, by theprocessor, a sandbox exception in response to executing the sandboxedapplication; means for dispatching, by the processor, the sandboxexception to a sandbox exception handler of the unsandbox in response togenerating the sandbox exception; means for executing, by the unsandboxin the first privilege level, a dispatch return instruction in responseto dispatching the sandbox exception; and means for resuming, by theprocessor, execution of the sandboxed application in the sandbox modeand in the first privilege level in response to executing the dispatchreturn instruction.

Example 129 includes the subject matter of Example 128, and wherein thefirst privilege level comprises a user privilege level of the processor.

Example 130 includes the subject matter of any of Examples 128 and 129,and wherein the first privilege level comprises a supervisor privilegelevel of the processor.

Example 131 includes the subject matter of any of Examples 128-130, andfurther comprising: means for executing, by the unsandbox, the dispatchhandler in the first privilege level in response to dispatching thesandbox exception; wherein the means for executing the dispatch returninstruction comprises means for executing the dispatch returninstruction in response to executing the dispatch handler.

Example 132 includes the subject matter of any of Examples 128-131, andwherein the means for dispatching the sandbox exception to the sandboxexception handler of the unsandbox comprises: means for storing, by theprocessor, one or more sandbox dispatch values into correspondingregisters of the processor in response to generating the sandboxexception, wherein the sandbox dispatch values include a return addresswithin the sandboxed application; means for clearing, by the processor,the sandbox flag of the processor in response to generating the sandboxexception; and means for jumping, by the processor, to the sandboxexception handler within the unsandbox in response to clearing thesandbox flag, wherein the sandbox exception handler is identified by adispatch instruction pointer register of the processor.

Example 133 includes the subject matter of any of Examples 128-132, andwherein the one or more sandbox dispatch values further include a returnaddress within the sandboxed application, a dispatch address associatedwith the sandbox exception, and dispatch qualification data associatedwith the sandbox exception.

Example 134 includes the subject matter of any of Examples 128-133, andwherein the means for resuming execution of the sandboxed applicationcomprises means for setting, by the processor, the sandbox flag of theprocessor.

Example 135 includes the subject matter of any of Examples 128-134, andwherein the means for setting the sandbox flag comprises means forsetting a sandbox flag bit of a sandbox enable control register of theprocessor.

Example 136 includes the subject matter of any of Examples 128-135, andfurther comprising: means for configuring, by the unsandbox, a rangeregister linked to a first segment register of the processor, whereinenabling the sandbox mode comprises enabling the sandbox mode inresponse to configuring the range register; wherein the means forexecuting the sandboxed application comprises means for mapping, by theprocessor, a logical address to a linear address, wherein the logicaladdress comprises a segment selector and an effective address, whereinthe segment selector is indicative of a segment base and an effectivelimit, and wherein the segment selector is associated with the firstsegment register; wherein the means for generating the sandbox exceptioncomprises means for determining, by the processor, whether the linearaddress is within memory bounds defined by the range register; andwherein the means for dispatching the sandbox exception comprises meansfor dispatching a segment range sandbox violation in response todetermining that the linear address is not within the memory boundsdefined by the range register.

Example 137 includes the subject matter of any of Examples 128-136, andwherein the means for configuring the range register comprises means forstoring an upper bound linear address and a lower bound linear addressin the range register.

Example 138 includes the subject matter of any of Examples 128-137, andwherein the means for dispatching the sandbox exception furthercomprises means for storing the linear address in a dispatch addressregister of the processor and means for storing a segment identifierindicative of the first segment register in a dispatch qualificationdata register of the processor.

Example 139 includes the subject matter of any of Examples 128-138, andfurther comprising means for executing, by the unsandbox, the dispatchhandler in the first privilege level in response to dispatching thesandbox exception, wherein the means for executing the dispatch handlercomprises: means for executing, by the unsandbox, an XSAVE instructionto save a sandbox configuration of a current thread; means for enabling,by the unsandbox, a sandbox flag in a second sandbox configuration thatcorresponds to a destination thread, wherein the second sandboxconfiguration is stored in an XSAVE memory area; means for executing, bythe unsandbox, an XRSTOR instruction to restore the second sandboxconfiguration in response to enabling the sandbox flag in the secondsandbox configuration; and means for switching to the destination threadin response to executing the XRSTOR instruction.

Example 140 includes the subject matter of any of Examples 128-139, andwherein: the means for executing the sandboxed application comprisesmeans for executing, by the sandboxed application, a near returninstruction; the means for generating the sandbox exception comprisesmeans for determining, by the processor, whether a top return address ofa shadow stack matches a top return address of a legacy stack inresponse to executing the near return instruction; and the means fordispatching the sandbox exception comprises means for dispatching, bythe processor, a stack mismatch violation in response to determiningthat the top return address of the shadow stack does not match the topreturn address of a legacy stack.

Example 141 includes the subject matter of any of Examples 128-140, andwherein the means for dispatching the sandbox exception furthercomprises means for storing the top return address of the legacy stackin a dispatch address register of the processor and means for storingthe top return address of the shadow stack in a dispatch qualificationdata register of the processor.

Example 142 includes the subject matter of any of Examples 128-141, andwherein the processor comprises a plurality of segment registers and aplurality of range registers, wherein each range register is linked to acorresponding segment register, and wherein the shadow stack is outsideof each of a plurality of memory bounds, wherein each memory bound isestablished by a corresponding range register.

Example 143 includes the subject matter of any of Examples 128-142, andwherein: the means for generating the sandbox exception furthercomprises means for determining, by the processor, whether a globalsandbox enable flag of a configuration register of the processor is setin response to executing the near return instruction; and the means fordispatching the sandbox exception further comprises means fordispatching the stack mismatch violation in response to determining thatthe top return address of the shadow stack does not match the top returnaddress of a legacy stack and determining that the global sandbox enableflag of the configuration register is set.

Example 144 includes the subject matter of any of Examples 128-143, andwherein: the means for generating the sandbox exception comprises meansfor executing, by the sandboxed application, a system call instruction;and the means for dispatching the sandbox exception comprises means fordispatching, by the processor, a system call exception to the unsandboxin the first privilege level in response to executing the system callinstruction.

Example 145 includes the subject matter of any of Examples 128-144, andfurther comprising: means for loading a host kernel in a supervisorprivilege level of the processor; and means for loading, by the hostkernel, a host application in the first privilege level, wherein thehost application comprises the unsandbox, and wherein the firstprivilege level comprises a user privilege level of the processor.

Example 146 includes the subject matter of any of Examples 128-145, andfurther comprising: means for loading a secure enclave in the hostapplication using secure enclave support of the processor; wherein themeans for executing the unsandbox in the first privilege level comprisesmeans for executing the unsandbox within the secure enclave; and whereinthe means for executing the sandboxed application in the sandbox modeand in the user privilege comprises means for executing the sandboxedapplication within the secure enclave.

Example 147 includes the subject matter of any of Examples 128-146, andfurther comprising: means for loading, by the host application of thecomputing device, a user-level virtual machine monitor, wherein theuser-level virtual machine monitor comprises the unsandbox; and meansfor loading, by the user-level virtual machine monitor, a user-levelparavirtualized kernel, wherein the user-level paravirtualized kernelcomprises the sandboxed application.

The invention claimed is:
 1. An apparatus comprising: a processorcoupled to a memory, the processor comprising a software isolationmanager circuitry, the software isolation manager circuitry to: execute,via an unsandbox, a dispatch handler in a first privilege level inresponse to a dispatch of a sandbox exception, wherein to execute thedispatch handler comprises to: execute, via the unsandbox, a firstinstruction to save a sandbox configuration of a current thread; enable,via the unsandbox, a sandbox flag in a second sandbox configuration thatcorresponds to a destination thread, wherein the second sandboxconfiguration is stored in a first instruction memory area; execute, viathe unsandbox, a second instruction to restore the second sandboxconfiguration in response to enablement of the sandbox flag in thesecond sandbox configuration; and switch to the destination thread inresponse to execution of the second instruction.
 2. The apparatus ofclaim 1, wherein the software isolation manager circuitry is further to:execute, via a sandboxed application, a near return instruction;generate the sandbox exception comprises to determine whether a topreturn address of a shadow stack matches a top return address of alegacy stack in response to execution of the near return instruction;and dispatch the sandbox exception comprises to dispatch a stackmismatch violation in response to a determination that the top returnaddress of the shadow stack does not match the top return address of alegacy stack, wherein the first instruction includes an XSAVEinstruction, and wherein the second instruction includes an XRSTORinstruction.
 3. The apparatus of claim 2, wherein to dispatch thesandbox exception further comprises to store the top return address ofthe legacy stack in a dispatch address register of the processor and tostore the top return address of the shadow stack in a dispatchqualification data register of the processor, and wherein the processorcomprises a plurality of segment registers and a plurality of rangeregisters, wherein each range register is linked to a correspondingsegment register, and wherein the shadow stack is outside of each of aplurality of memory bounds, wherein each memory bound is established bya corresponding range register.
 4. The apparatus of claim 2, wherein togenerate the sandbox exception further comprises to determine, by theprocessor, whether a global sandbox enable flag of a configurationregister of the processor is set in response to executing the nearreturn instruction, and wherein to dispatch the sandbox exceptionfurther comprises to dispatch the stack mismatch violation in responseto the determination that the top return address of the shadow stackdoes not match the top return address of the legacy stack and adetermination that the global sandbox enable flag of the configurationregister is set, and wherein to generate the sandbox exception comprisesto execute, by the sandboxed application, a system call instruction, andto dispatch the sandbox exception comprises to dispatch, by theprocessor, a system call exception to the unsandbox in the firstprivilege level in response to execution of the system call instruction.5. The apparatus of claim 1, wherein the software isolation managercircuitry is further to: load a host kernel in a supervisor privilegelevel of the processor; and load, by the host kernel, a host applicationin the first privilege level, wherein the host application comprises theunsandbox, and wherein the first privilege level comprises a userprivilege level of the processor, wherein the software isolation managercircuitry is further to load a secure enclave in the host applicationusing secure enclave support of the processor; wherein to execute theunsandbox in the first privilege level comprises to execute theunsandbox within the secure enclave; and wherein to execute thesandboxed application in the sandbox mode and in the user privilegecomprises to execute the sandboxed application within the secureenclave, wherein the software isolation manager circuitry is further toload, by the host application of the computing device, a user-levelvirtual machine monitor, wherein the user-level virtual machine monitorcomprises the unsandbox; and load, by the user-level virtual machinemonitor, a user-level paravirtualized kernel, wherein the user-levelparavirtualized kernel comprises the sandboxed application, wherein theprocessor includes one or more of an application processor or a graphicsprocessor.
 6. A method comprising: executing, by a processor of acomputing device, a dispatch handler in a first privilege level inresponse to a dispatch of a sandbox exception, wherein executing thedispatch handler comprises to: executing a first instruction to save asandbox configuration of a current thread; enabling a sandbox flag in asecond sandbox configuration that corresponds to a destination thread,wherein the second sandbox configuration is stored in a firstinstruction memory area; executing a second instruction to restore thesecond sandbox configuration in response to enablement of the sandboxflag in the second sandbox configuration; and switching to thedestination thread in response to execution of the second instruction.7. The method of claim 6, further comprising: executing, by theprocessor, via a sandboxed application, a near return instruction;generating the sandbox exception comprises to determine whether a topreturn address of a shadow stack matches a top return address of alegacy stack in response to execution of the near return instruction;and dispatching the sandbox exception comprises to dispatch a stackmismatch violation in response to a determination that the top returnaddress of the shadow stack does not match the top return address of alegacy stack, wherein the first instruction includes an XSAVEinstruction, and wherein the second instruction includes an XRSTORinstruction.
 8. The method of claim 7, wherein dispatching the sandboxexception further comprises storing the top return address of the legacystack in a dispatch address register of the processor and storing thetop return address of the shadow stack in a dispatch qualification dataregister of the processor, and wherein the processor comprises aplurality of segment registers and a plurality of range registers,wherein each range register is linked to a corresponding segmentregister, and wherein the shadow stack is outside of each of a pluralityof memory bounds, wherein each memory bound is established by acorresponding range register.
 9. The method of claim 7, whereingenerating the sandbox exception further comprises to determiningwhether a global sandbox enable flag of a configuration register of theprocessor is set in response to executing the near return instruction,and wherein dispatching the sandbox exception further comprisesdispatching the stack mismatch violation in response to thedetermination that the top return address of the shadow stack does notmatch the top return address of the legacy stack and a determinationthat the global sandbox enable flag of the configuration register isset, and wherein generating the sandbox exception comprises toexecuting, by the processor via the sandboxed application, a system callinstruction, and wherein dispatching the sandbox exception comprises todispatching a system call exception to the unsandbox in the firstprivilege level in response to execution of the system call instruction.10. The method of claim 6, further comprising: loading a host kernel ina supervisor privilege level of the processor; and load, by the hostkernel, a host application in the first privilege level, wherein thehost application comprises the unsandbox, and wherein the firstprivilege level comprises a user privilege level of the processor;loading a secure enclave in the host application using secure enclavesupport of the processor; wherein to execute the unsandbox in the firstprivilege level comprises to execute the unsandbox within the secureenclave; and wherein to execute the sandboxed application in the sandboxmode and in the user privilege comprises to execute the sandboxedapplication within the secure enclave; and loading a user-level virtualmachine monitor, wherein the user-level virtual machine monitorcomprises the unsandbox; and load, by the user-level virtual machinemonitor, a user-level paravirtualized kernel, wherein the user-levelparavirtualized kernel comprises the sandboxed application, wherein theprocessor includes one or more of an application processor or a graphicsprocessor.
 11. A non-transitory computer-readable medium having storedthereon instructions which, when executed cause a computing device toperform operations comprising: executing a dispatch handler in a firstprivilege level in response to a dispatch of a sandbox exception,wherein executing the dispatch handler comprises: executing a firstinstruction to save a sandbox configuration of a current thread;enabling a sandbox flag in a second sandbox configuration thatcorresponds to a destination thread, wherein the second sandboxconfiguration is stored in a first instruction memory area; executing asecond instruction to restore the second sandbox configuration inresponse to enablement of the sandbox flag in the second sandboxconfiguration; and switching to the destination thread in response toexecution of the second instruction.
 12. The non-transitorycomputer-readable medium of claim 11, wherein the operations furthercomprise: executing, via a sandboxed application, a near returninstruction; generating the sandbox exception comprises to determinewhether a top return address of a shadow stack matches a top returnaddress of a legacy stack in response to execution of the near returninstruction; and dispatching the sandbox exception comprises to dispatcha stack mismatch violation in response to a determination that the topreturn address of the shadow stack does not match the top return addressof a legacy stack, wherein the first instruction includes an XSAVEinstruction, and wherein the second instruction includes an XRSTORinstruction.
 13. The non-transitory computer-readable medium of claim12, wherein dispatching the sandbox exception further comprises storingthe top return address of the legacy stack in a dispatch addressregister of the processor and storing the top return address of theshadow stack in a dispatch qualification data register of the processor,and wherein the processor comprises a plurality of segment registers anda plurality of range registers, wherein each range register is linked toa corresponding segment register, and wherein the shadow stack isoutside of each of a plurality of memory bounds, wherein each memorybound is established by a corresponding range register.
 14. Thenon-transitory computer-readable medium of claim 12, wherein generatingthe sandbox exception further comprises to determining whether a globalsandbox enable flag of a configuration register of the processor is setin response to executing the near return instruction, and whereindispatching the sandbox exception further comprises dispatching thestack mismatch violation in response to the determination that the topreturn address of the shadow stack does not match the top return addressof the legacy stack and a determination that the global sandbox enableflag of the configuration register is set, and wherein generating thesandbox exception comprises to executing, by the processor via thesandboxed application, a system call instruction, and whereindispatching the sandbox exception comprises to dispatching a system callexception to the unsandbox in the first privilege level in response toexecution of the system call instruction.
 15. The non-transitorycomputer-readable medium of claim 12, wherein the operations furthercomprise: loading a host kernel in a supervisor privilege level of theprocessor; and load, by the host kernel, a host application in the firstprivilege level, wherein the host application comprises the unsandbox,and wherein the first privilege level comprises a user privilege levelof the processor; loading a secure enclave in the host application usingsecure enclave support of the processor; wherein to execute theunsandbox in the first privilege level comprises to execute theunsandbox within the secure enclave; and wherein to execute thesandboxed application in the sandbox mode and in the user privilegecomprises to execute the sandboxed application within the secureenclave; and loading a user-level virtual machine monitor, wherein theuser-level virtual machine monitor comprises the unsandbox; and load, bythe user-level virtual machine monitor, a user-level paravirtualizedkernel, wherein the user-level paravirtualized kernel comprises thesandboxed application, wherein the processor includes one or more of anapplication processor or a graphics processor.
 16. A data processingsystem comprising: one or more processors; a memory coupled to the oneor more processors, the one or more processors to: execute, via anunsandbox, a dispatch handler in a first privilege level in response toa dispatch of a sandbox exception, wherein to execute the dispatchhandler comprises to: execute, via the unsandbox, a first instruction tosave a sandbox configuration of a current thread; enable, via theunsandbox, a sandbox flag in a second sandbox configuration thatcorresponds to a destination thread, wherein the second sandboxconfiguration is stored in a first instruction memory area; execute, viathe unsandbox, a second instruction to restore the second sandboxconfiguration in response to enablement of the sandbox flag in thesecond sandbox configuration; and switch to the destination thread inresponse to execution of the second instruction.
 17. The data processingsystem of claim 16, wherein the one or more processors are further to:execute, via a sandboxed application, a near return instruction;generate the sandbox exception comprises to determine whether a topreturn address of a shadow stack matches a top return address of alegacy stack in response to execution of the near return instruction;and dispatch the sandbox exception comprises to dispatch a stackmismatch violation in response to a determination that the top returnaddress of the shadow stack does not match the top return address of alegacy stack, wherein the first instruction includes an XSAVEinstruction, and wherein the second instruction includes an XRSTORinstruction.
 18. The data processing system of claim 17, wherein todispatch the sandbox exception further comprises to store the top returnaddress of the legacy stack in a dispatch address register of aprocessor and to store the top return address of the shadow stack in adispatch qualification data register of the processor, and wherein theprocessor comprises a plurality of segment registers and a plurality ofrange registers, wherein each range register is linked to acorresponding segment register, and wherein the shadow stack is outsideof each of a plurality of memory bounds, wherein each memory bound isestablished by a corresponding range register.
 19. The data processingsystem of claim 17, wherein to generate the sandbox exception furthercomprises to determine, by the processor, whether a global sandboxenable flag of a configuration register of the processor is set inresponse to executing the near return instruction, and wherein todispatch the sandbox exception further comprises to dispatch the stackmismatch violation in response to the determination that the top returnaddress of the shadow stack does not match the top return address of thelegacy stack and a determination that the global sandbox enable flag ofthe configuration register is set, and wherein to generate the sandboxexception comprises to execute, by the sandboxed application, a systemcall instruction, and to dispatch the sandbox exception comprises todispatch, by the processor, a system call exception to the unsandbox inthe first privilege level in response to execution of the system callinstruction.
 20. The data processing system of claim 17, wherein the oneor more processors are further to: load a host kernel in a supervisorprivilege level of the processor; and load, by the host kernel, a hostapplication in the first privilege level, wherein the host applicationcomprises the unsandbox, and wherein the first privilege level comprisesa user privilege level of the processor, wherein the software isolationmanager circuitry is further to load a secure enclave in the hostapplication using secure enclave support of the processor; wherein toexecute the unsandbox in the first privilege level comprises to executethe unsandbox within the secure enclave; and wherein to execute thesandboxed application in the sandbox mode and in the user privilegecomprises to execute the sandboxed application within the secureenclave, wherein the software isolation manager circuitry is further toload, by the host application of the computing device, a user-levelvirtual machine monitor, wherein the user-level virtual machine monitorcomprises the unsandbox; and load, by the user-level virtual machinemonitor, a user-level paravirtualized kernel, wherein the user-levelparavirtualized kernel comprises the sandboxed application, wherein theprocessor includes one or more of an application processor or a graphicsprocessor.